$(function(){ setTimeout(function() { let shoppingCartWidget = $('[data-component-shoppingcart]'); if (shoppingCartWidget.length > 0) { let shoppingCart = init_shopping_cart(); /*$('.add-to-cart').on('click', function(event) { event.preventDefault(); let title = $(this).data('name'); let id = $(this).data('id'); let ref_object = $(this).data('ref_object'); let price = Number($(this).data('price')); shoppingCart.addItemToCart(id, ref_object, title, price, 1); displayCart(); });*/ shoppingCartWidget.find('.clear-cart').click(function() { shoppingCart.clearCart(); displayCart(); }); function displayCart() { let cartArray = shoppingCart.listCart(); let output = ""; for(var i in cartArray) { output += "<tr>" + "<td>" + cartArray[i].id + "</td>" + "<td>" + cartArray[i].title + "</td>" + "<td>(" + cartArray[i].price + ")</td>" + "<td><div class='input-group'><button class='minus-item input-group-addon btn btn-primary' data-id=" + cartArray[i].id + ">-</button>" + "<input type='number' class='item-count form-control' data-id='" + cartArray[i].id + "' value='" + cartArray[i].count + "'>" + "<button class='plus-item btn btn-primary input-group-addon' data-id=" + cartArray[i].id + ">+</button></div></td>" + "<td><button class='delete-item btn btn-danger' data-id=" + cartArray[i].id + ">X</button></td>" + " = " + "<td>" + cartArray[i].total + "</td>" + "</tr>"; } shoppingCartWidget.find('.show-cart').html(output); shoppingCartWidget.find('.total-cart').html(shoppingCart.totalCart()); shoppingCartWidget.find('.total-count').html(shoppingCart.totalCount()); } shoppingCartWidget.find('.show-cart').on("click", ".delete-item", function(event) { let id = $(this).data('id'); shoppingCart.removeItemFromCartAll(id); displayCart(); }); shoppingCartWidget.find('.show-cart').on("click", ".minus-item", function(event) { let id = $(this).data('id'); shoppingCart.removeItemFromCart(id); displayCart(); }); shoppingCartWidget.find('.show-cart').on("click", ".plus-item", function(event) { let id = $(this).data('id'); shoppingCart.addItemToCart(id); displayCart(); }); shoppingCartWidget.find('.show-cart').on("change", ".item-count", function(event) { let id = $(this).data('id'); let count = Number($(this).val()); shoppingCart.setCountForItem(id, count); displayCart(); }); displayCart(); } }, 1500); });

Give Us a Call to Know More

CONTACT US

Send us your requirements

Please provide as much details as needed.

$(function(){ setTimeout(function () { fillFormBasicInfoFields(); }, 2000); });