Loading...'); for (var i in cart) { if(cart[i].SKU == sku) { cart[i].Qty = qty; showCart(); saveCart(); return; } } // create JavaScript Object var item = { Product: name, Price: price, Qty: qty, SKU: sku,Image:imageUrl,Details:details,InvNO:invNo }; // console.log(item); // addcartprocess(item); cart.push(item); // $('#cartButton_'+sku).html(' added to cart'); // $('#cartButton_'+sku).attr("style","background:#5cb85c !important"); saveCart(); showCart(); } //console.log(cart); function addToCartNew(type,sku) { //alert('hii'); if($("#quantiti_"+type+"_"+sku).val() == '') { alert('Please select quantity'); return; } var price = $("#itemPrice_"+sku).val(); var name = $("#itemName_"+sku).val(); var qty = $("#quantiti_"+type+"_"+sku).val(); var sku = sku; var imageUrl = $('#imageUrl_'+sku).val(); var details = $('#detail_'+sku).val(); var invNo = $('#invNoId_'+sku).val(); //console.log(details); //$('#cartButton_'+sku).attr("disabled",true); // update qty if product is already present $('#cartButton_'+type+'_'+sku).attr("style","background:#5cb85c !important"); $('#cartButton_'+type+'_'+sku).html(' added to cart'); for (var i in cart) { if(cart[i].SKU == sku) { cart[i].Qty = qty; showCart(); saveCart(); return; } } // create JavaScript Object var item = { Product: name, Price: price, Qty: qty, SKU: sku,Image:imageUrl,Details:details,InvNO:invNo }; console.log(item); addcartprocess(item); cart.push(item); saveCart(); showCart(); } function addToCart(sku) { if($("#quantiti_"+sku).val() == '') { alert('Please select quantity'); return; } var price = $("#itemPrice_"+sku).val(); var name = $("#itemName_"+sku).val(); var qty = $("#quantiti_"+sku).val(); var sku = sku; var imageUrl = $('#imageUrl_'+sku).val(); var details = $('#detail_'+sku).val(); var invNo = $('#invNoId_'+sku).val(); //console.log(details); //$('#cartButton_'+sku).attr("disabled",true); // update qty if product is already present // $('#cartButton_'+sku).html('Loading...'); for (var i in cart) { if(cart[i].SKU == sku) { cart[i].Qty = qty; showCart(); saveCart(); return; } } // create JavaScript Object var item = { Product: name, Price: price, Qty: qty, SKU: sku,Image:imageUrl,Details:details,InvNO:invNo }; addcartprocess(item); cart.push(item); $('#cartButton_'+sku).html(' added to cart'); $('#cartButton_'+sku).attr("style","background:#5cb85c !important"); saveCart(); showCart(); } function deleteItem(index){ //alert(index); for (i=0;i