Jump to content

different product page for one of products


uzytkownik78

Recommended Posts

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.

  • Like 1
Link to comment
Share on other sites

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');

}

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

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 by Shutiri (see edit history)
Link to comment
Share on other sites

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

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

  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...