I am currently working on a combo offer on NopCommerce
. So I need to add multiple product to cart at a single click. The built in NopCommerce format is for adding single product into cart is
AjaxCart.addproducttocart_catalog('/addproducttocart/catalog/' + productId + '/1/1'
and
AjaxCart.addproducttocart_details('/addproducttocart/details/' +productId + '/1', '#product-details-form')
Both of them work fine for adding single product. But when I want to add multiple product then the it just add single product to the cart. Mention that I am sending a string with a coma separative value which is list of products and inside Javascript it is parsing as a single prodcut Id. However, it is adding only single product in the cart. Which Product Id is the the lowest that product is adding to the cart.
Here is my piece of javascript code
function addComboProductToCart(ids) {
var arrayOfStrings = ids.split(',');
for (var i = 0; i < arrayOfStrings.length; i++) {
AjaxCart.addproducttocart_catalog('/addproducttocart/catalog/' + arrayOfStrings[i] + '/1/1');
}
}
But it is not showing a single error too. So where is the problem?