Reputation: 21
I'm writing a module to Prestashop. My module adds a small widget on cart view. The content of widget depends on cart content. My question is how to update my widget when user changes quantity of product or removes product from cart. This action is done via AJAX, so page is not refreshed and my widget is not refreshed as well. It would by nice find solution that doesn't require changes in templates - installing module should by enough.
Thanks, amos
Upvotes: 1
Views: 8326
Reputation: 31
I am using PrestaShop 1.7 and have used the following code to grab the response and update my cart icon.
Documentation can be found here: http://developers.prestashop.com/themes/javascript/index.html
prestashop.on('updatedCart', function(event) {
$('.nav-container .shopping-cart .shopping-cart-icon-count').text(this.cart.products_count)
});
Upvotes: 3