File: D:/HostingSpaces/Neopoints/momsecurity.be/resources/assets/js/shop/cart.js
var ShoppingCart = {
// Initialize click event
init: function () {
// init something
},
addProductToShoppingcart: function (id, type) {
let amount = 10;
Ajax.post(
'/addProductToShoppingcart',
{productableID: id, itemType: type, amount: amount},
function(xhr) {
window.location = xhr.response;
}
);
},
removeItemFromShoppingcart: function (id, type) {
Ajax.post(
'/removeItemFromShoppingcart',
{productableID: id, itemType: type},
function(xhr) {
window.location = xhr.response;
}
);
},
setItemAmountInShoppingcart: function (id, amount) {
if (amount > 0) {
Ajax.post(
'/setItemAmountInShoppingcart',
{itemID: id, amount: amount},
function(xhr) {
window.location = xhr.response;
}
);
} else {
this.removeItemFromShoppingcart(id);
}
},
updateCartButtonCounter: function () {
var count = $(".shoppingcartItemList ul li").length;
$(".shoppingCartButton span.shoppingCartButtonCounter").html(count);
}
};
ShoppingCart.init();