uzytkownik78 Posted September 21, 2013 Share Posted September 21, 2013 first of all sorry for my english i just did styling of my product page for prestashop 1.5 it looks OK but I would like to have "indivitudal product" that looks very different than all other products in my prestashop (different in css/positions of everything) i know there is possibility to single out products by id but it is not css and looks like javascript or something that i can not do. Can someone help me? I can manage small changes in tpl files too but for now i have no idea how to do this. 1 Link to comment Share on other sites More sharing options...
vekia Posted September 21, 2013 Share Posted September 21, 2013 you can do it in productController.php file just depending on product id define other template file if (Tools::getValue('id_product')==2){ $this->setTemplate(_PS_THEME_DIR_.'my-new-product-template.tpl'); } else { $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } 1 Link to comment Share on other sites More sharing options...
uzytkownik78 Posted September 21, 2013 Author Share Posted September 21, 2013 wow you are fast THANKS! Link to comment Share on other sites More sharing options...
vekia Posted September 21, 2013 Share Posted September 21, 2013 you're welcome of course i was thought about controllers/front/productController.php file Link to comment Share on other sites More sharing options...
uzytkownik78 Posted September 21, 2013 Author Share Posted September 21, 2013 i have little trouble finding files just editing and those php code lines... Link to comment Share on other sites More sharing options...
vekia Posted September 21, 2013 Share Posted September 21, 2013 in file: controllers/front/productController.php search for: $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); then change it to code that i suggested, of course change product id value 1 Link to comment Share on other sites More sharing options...
Shutiri Posted January 3, 2015 Share Posted January 3, 2015 (edited) Hello Vekia, I did this and it worked perfectly on a per-product basis. This is already very good I'm trying to make the functionality more broad, by defining a product template per-category as well (all products in given category share same .tpl template file) Just after the code you shared, I did this: if (Tools::getValue('id_category')==7){ $this->setTemplate(_PS_THEME_DIR_.'my-new-product-template.tpl'); } else { $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } It's not working, I guess the 'id_category' variable is incorrect. Any ideas ? Thx! Edited January 3, 2015 by Shutiri (see edit history) Link to comment Share on other sites More sharing options...
Shutiri Posted January 4, 2015 Share Posted January 4, 2015 FIXED!! if ($this->category->id>=5 && $this->category->id<=7 || $this->category->id==11){ $this->setTemplate(_PS_THEME_DIR_.'productAlt.tpl'); // template file for caregories between 5 and 7, OR category 11 } else { $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); // DEFAULT template } Cheers! Link to comment Share on other sites More sharing options...
vekia Posted January 4, 2015 Share Posted January 4, 2015 FIXED!! if ($this->category->id>=5 && $this->category->id<=7 || $this->category->id==11){ $this->setTemplate(_PS_THEME_DIR_.'productAlt.tpl'); // template file for caregories between 5 and 7, OR category 11 } else { $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); // DEFAULT template } Cheers! than you for posting solution indeed, it's better to use $this variable :-) Link to comment Share on other sites More sharing options...
Shutiri Posted January 4, 2015 Share Posted January 4, 2015 Cool, thx. I did a new post with all required instructions here: http://www.prestashop.com/forums/topic/392095-how-to-different-producttpl-template-on-a-page-per-product-and-a-per-category-basis/?do=findComment&comment=1914587 Link to comment Share on other sites More sharing options...
Takuya Posted March 12, 2019 Share Posted March 12, 2019 Hi, Is it possible to achieve this in Prestashop 1.7.4.2 ? Kind regards, 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