Jump to content

[SOLVED] how to use Different Template for every category!


melas

Recommended Posts

yes it is possible but in this case you will have to change several things:

controllers, and also .tpl & css files.

 

in CategoryController.php file located in: controllers/front/ directory you've got initContent() function with code:
 

$this->setTemplate(_PS_THEME_DIR_.'category.tpl');

you need to define different template file for categories, for example:

if ($this->category->id==5){
$this->setTemplate(_PS_THEME_DIR_.'category-for-id-5.tpl'); // template file for caregory id: 5
} else {
$this->setTemplate(_PS_THEME_DIR_.'category.tpl'); // DEFAULT template
}
  • Like 6
Link to comment
Share on other sites

in addition to what i said above, remember, that in category.tpl you've got additional .tpl files like product-list.tpl etc.

if you want to customize separate pages, you need to include these files, or other - modified files

 

im going to mark this topic as solved

 

best regards

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 10 months later...
  • 2 months later...
  • 2 weeks later...

found a solution after reading php docs

		if ($this->category->id==4 || $this->category->id==8 || $this->category->id==5){
			$this->setTemplate(_PS_THEME_DIR_.'category1.tpl');
		} elseif ($this->category->id==9 || $this->category->id==10 || $this->category->id==11){
			$this->setTemplate(_PS_THEME_DIR_.'category2.tpl');
		} else {
			$this->setTemplate(_PS_THEME_DIR_.'category.tpl');
		}
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

in addition to what i said above, remember, that in category.tpl you've got additional .tpl files like product-list.tpl etc.

if you want to customize separate pages, you need to include these files, or other - modified files

 

im going to mark this topic as solved

 

best regards

Hi vekia

 

is it possible to setup for the price drop  different pages for each category?

 

I would to show the promotions articles in different pages for man, woman and not in only one page.

 

thanks

Angela

Link to comment
Share on other sites

  • 1 year 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...