bendobush Posted April 27, 2022 Share Posted April 27, 2022 Hello, I am setting up a "sticky add to cart" banner on the product page. I have created a new TPL file in my theme, however I have a problem with products with attributs. Indeed, we can not directly change the attributs on the banner but there is only a reminder of the declination chosen with the price and the button "add to cart". However, when you change attribut without refreshing the page, the attribut displayed on the banner does not change. How can I make sure that the TPL file is reloaded each time I change product attribut ? Thank you for your answers, please be lenient, I am not a developer by formation. Link to comment Share on other sites More sharing options...
knacky Posted April 28, 2022 Share Posted April 28, 2022 https://devdocs.prestashop.com/1.7/themes/reference/javascript-events/#dispatched-events Link to comment Share on other sites More sharing options...
bendobush Posted May 20, 2022 Author Share Posted May 20, 2022 Hello, I finally found the solution for all those who would struggle like me lol We need to add a block section name like : {block name='my_section'} {include file='my_file.tpl'} {/block} And add the line to ProductController.php : 'my_section' => $this->render('my_file.tpl'), And finally add this to the file core.js : (0,r.default)(".quickview .my_file_class_name, #product .my_file_class_name").replaceWith(e.my_section), AND IT'S WORK!! Just if someone could confirm me that the core.js file can be modified without worries? Hoping to have helped someone ! Link to comment Share on other sites More sharing options...
[email protected] Posted January 19, 2023 Share Posted January 19, 2023 (edited) Hi bendobush, I am looking to do the same as you. Can you explain to me how and where to insert the portion of code in the ProductController.php? Regarding the core.js, isn't it better to insert it in the custom.js? Please note that I am not a development expert. By the way my version of prestashop is 1.7.7.8 Think's for your reply. Regards Edited January 19, 2023 by [email protected] (see edit history) 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