When function is called it adds that one product found into the shopping cart.
How can I update this to loop thru for each itme listed on the page, Each Item has a Unique ID (uProdID)?
//Check if the product already exist in Cart if exist update quantity
for (var a in productCart) {
if (productName == productCart[a].productName && giftPrice == productCart[a].productPrice){
prdQty = productCart[a].productQty++;
updateCart();
addToCart();
//Update Cart Summary Top Header
updateCartSummary();
return false;
}
}
Here is the unique ID & how it is associated.
var prodId = $(this).attr(‘id’);
var onlyProdId = prodId.substring(4);
I know we should be using a each function to loop thru each item on page but this is what we add and it seem incorrect, any help will be great
//Be sure the Valdiate each Item ID is correct before loading
//Shopping Cart
var productCart = $(product_item_'+uProdID+');
productCart.each(function(idx, li) {
var products = a;
//Check if the product already exist in Cart if exist update quantity
for (var a in productCart) {
if (productName == productCart[a].productName && giftPrice == productCart[a].productPrice){
prdQty = productCart[a].productQty++;
alert();
//updateCart();
//Update Cart Summary Top Header
//updateCartSummary();
return false;
}
}
});