Jump to content

Different Layout for different products


Recommended Posts

productController.php located in /controllers/front/ directory

depending on product ID load template file you want to display:

        if ($this->product->id==5){
          $this->setTemplate(_PS_THEME_DIR_.'theme-file-for-product-with-id-5.tpl');  
        } else {
		  $this->setTemplate(_PS_THEME_DIR_.'product.tpl');
        }
Link to comment
Share on other sites

  • 1 month later...

or by category replace on line 293 $this->setTemplate(_PS_THEME_DIR_.'product.tpl');


 if ($this->product->id_category_default == 15 || $this->product->id_category_default == 16 ){
        $this->setTemplate(_PS_THEME_DIR_.'product-abb.tpl');}
        else
        $this->setTemplate(_PS_THEME_DIR_.'product.tpl');

 

or what ever you want :-)

Link to comment
Share on other sites

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...