Jump to content

Module Select and add multiple products to cart


Recommended Posts

Thank you.

If you have made a module, I think many would be willing to pay for it, including me.
I just can not believe that a similar module is in Magento, openсart and wordpress, but it is not for prestashop.
It's basic addon for all eshop I think.
Link to comment
Share on other sites

  • 4 weeks later...

It can't be done in a module as you need to edit core files each time, that's why. They should just implement it into the core

 

I used your tutorial.

Thank you very much! It's very helpful.

Look please

 

Could you help me one more time?

There is the checkbox "Select all" above the table of product list.

How to assign check all action for checkboxes below?

Best Regards

Edited by Makatserchyk (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Hello,

Thanks for you tutorial it's very helpful but i need to add differents product on page product :

For exemple i am on a page product (pull)  and i want to add in one click :

5 Small Size color blue

7 Medium Size color blue

12 Large Size color red

 

Do you know how can i do that ?

 

Thank you

Link to comment
Share on other sites

  • 3 weeks later...

You need to hardcode those info in each block you are adding, like using data-id_product and data-id_product_attribute for each. Use an $.each look to go through them, and add them one by one like described in the tut

 

Happy New year NemoPS.

 

Could you help once more please?

 

Each product is placed in a separate shopping cart when I press the button "Add selected to cart".

For example:

if I select 12 products that 12 shopping carts will be created when I press the button.

 

Most likely this is due to the absence an active shopping cart.

How can I check cart existence or use active cart?

Link to comment
Share on other sites

What do you mean it creates 12 shopping carts? There is just one instance of it, what code are you using to add the products?

You should also do it one AFTER the other, not simultaneously

Yes. 12 shopping carts. But when I select next products and press the button It add them into one of the 12 existing. I'm using code from tut.

 

 

Prestahop 1.6.1.7

Edited by Makatserchyk (see edit history)
Link to comment
Share on other sites

  • 2 months later...

Use an $.each and add them one by one. Make sure the ajax call has async: false

 

Hello Fabio,

 

Could you help me please one more time with your tut.

 

I'll try to add products with attributes and get two variables from checked items

 

<input type="checkbox" name="cproduct" value="{$product.id_product}" value2="{$product.id_product_attribute}" class="add_me_to_cart"/>{l s='Select item'}

 

 

How can I separate those variables in your code?

$('.multi_add').unbind('click').click(function() {
        
    // get all checked items
    var checked_items = $('.add_me_to_cart:checked');
 
    if(checked_items.length == 0)
        alert(noSelectionTxt);
    else {
        $.each(checked_items, function(i, item) {
             var id_prd = $(item).val(); // val of the checkbox!
             ajaxCart.add(id_prd, null, false, $(item).parent().parent().find('.ajax_add_to_cart_button'));
             // uncheck current element
             $(item).removeAttr('checked');
        });
    }
    
 
});
 
Regards
Edited by Makatserchyk (see edit history)
Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...