Med Aziz Posted April 16, 2022 Share Posted April 16, 2022 Hello everyone, I've been looking for this for quite sometime but i can't seem to find the correct way to display certain products using their ID on custom prestashop page and in page.tpl I'll be grateful if anyone could help me Thank you've Link to comment Share on other sites More sharing options...
Ress Posted April 16, 2022 Share Posted April 16, 2022 If you need to put on a cms page, you can use this module. If you want to put on another page, you can be inspired from here to do the same for the page where you need it. https://mypresta.eu/modules/front-office-features/products-on-cms-pages.html Link to comment Share on other sites More sharing options...
Med Aziz Posted April 16, 2022 Author Share Posted April 16, 2022 53 minutes ago, Ress said: If you need to put on a cms page, you can use this module. If you want to put on another page, you can be inspired from here to do the same for the page where you need it. https://mypresta.eu/modules/front-office-features/products-on-cms-pages.html Thanks for your reply. Actually, I've tested this module but you can't use it in page.tpl. however, if it's possible i don't wanna use any module to display the specific products. thanks again Link to comment Share on other sites More sharing options...
Ress Posted April 16, 2022 Share Posted April 16, 2022 It's too general when you say you use it in page.tpl. Which page (controller) exactly do you want to use? Link to comment Share on other sites More sharing options...
Med Aziz Posted April 17, 2022 Author Share Posted April 17, 2022 15 hours ago, Ress said: It's too general when you say you use it in page.tpl. Which page (controller) exactly do you want to use? i'm using javascript so i'm writing my code in themes\myTheme\templates\cms\page.tpl Link to comment Share on other sites More sharing options...
Ress Posted April 17, 2022 Share Posted April 17, 2022 Can you detail a little more what you want to do exactly? In principle, if you use javascript and have product ids, you can make an ajax to a controller, and bring the product details, after which you can display them on the page. Link to comment Share on other sites More sharing options...
Med Aziz Posted April 17, 2022 Author Share Posted April 17, 2022 24 minutes ago, Ress said: Can you detail a little more what you want to do exactly? In principle, if you use javascript and have product ids, you can make an ajax to a controller, and bring the product details, after which you can display them on the page. Actually i'm writing an algorithm to display some specific products based on the answers of the user , that's why i used javascript. can you tell please me how to do it with ajax Thanks Link to comment Share on other sites More sharing options...
Ress Posted April 17, 2022 Share Posted April 17, 2022 You need to do this in a plugin, you have to put the controller in: ex. your_module/controllers/front/ajax.php You can see more details here, e.g. what class you need to extend, how to generate the link to the controller, which you should call when you make the ajax request. https://devdocs.prestashop.com/1.7/modules/concepts/controllers/front-controllers/ You will have to send the product ids through ajax, there if you have the ids, bring the product details, fetch a template, and send the html back and append. 1 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