2

Hi i am working on site where i can add products to cart using query like this :

window.location.href = '<?php echo Mage::getBaseUrl(); ?>checkout/cart/add?product=<?php echo $current_product_id; ?>&qty='+ qty + '&super_attribute[139]='+ size +'&super_attribute[141]='+ color+'';

Now i am trying to submit multiple item to cart with single query (only options to add to cart) .I try above method by sending static parameters but it only adds one product.As there any alternative for this ? thanks in advance. I saw this method but this uses options with product ids.I have only option/parameters

0

Normally there is no way to add multiple simple items to cart. Checked out grouped or bundled products?

Otherwise, if you need to add multiple simple items at once, you should override the cartController (addAction) and implement some array handling to fit your needs.

cheers

0

After trying some custom code i got my answer.May be its not proper answer but can help while doing custom code.I am doing that using js like this :

var color = getcolor();// Fetch all the colors
var qty = get_qty();//Fetch all the quantities
var size = getsize();//Fetch all sizes
 var url ='';

for (i = 0; i < size.length; i++) {

  jQuery.ajax({url: '<?php echo Mage::getBaseUrl(); ?>checkout/cart/add?product=<?php echo $current_product_id;?>&qty='+ qty[i] + '&super_attribute[139]='+ size[i] +'&super_attribute[141]='+ color[i]+'', 
        success: function(data) {
          console.log('Data Sent');
        }
    })

}
window.location.href = '<?php echo Mage::getBaseUrl(); ?>checkout/cart/';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.