VianneyYooCI Posted January 18, 2019 Share Posted January 18, 2019 Hello ! I just downloaded the 1.7 version of prestashop and I try to redo things that I used to do in the 1.6 version, like custom module and editing the template files. For training I've created a module that display a custom page with a set of products that I choose, and I want to add a simple button to add the product. In 1.6 you just add to call ajaxCart.add with the id and quantity of your chosen product and prestashop will then handle it, but I just can't find that function in 1.7, does it even exist ? The product page works in ajax and even show a modal so I think that this kind of function exist somewhere. Does somebody knows ? Thank you for your responses ! Link to comment Share on other sites More sharing options...
Rhobur Posted January 20, 2019 Share Posted January 20, 2019 you're probably referring to /modules/ps_shoppingcart/ps_shoppingcart.js Link to comment Share on other sites More sharing options...
VianneyYooCI Posted January 21, 2019 Author Share Posted January 21, 2019 Yes, the problem is that I can't find the method which update the cart in that file Link to comment Share on other sites More sharing options...
JBW Posted January 21, 2019 Share Posted January 21, 2019 Not sure what exactly you want to archieve, but maybe you are looking for this file: https://github.com/PrestaShop/PrestaShop/blob/c2a71fdd63d3ccf176e5c33070fa17d81a0d73f2/themes/classic/_dev/js/cart.js You can listen on 'updateCart' and 'updatedCart' events of prestashop object to insert your functionality Link to comment Share on other sites More sharing options...
VianneyYooCI Posted January 22, 2019 Author Share Posted January 22, 2019 I'll look into that, thank you ! Link to comment Share on other sites More sharing options...
Ordoki Posted September 19, 2021 Share Posted September 19, 2021 Hi VianneyYooCl, Have you solved your problem ? Could you please share a piece of code ? I am in a similar situation and I do not know how to add items to the cart programmatically. Thank you ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now