Jump to content

Different product template for specific categories

Recommended Posts

I need to create different product templates for specific categories for PS 1.7.6. I've tried various solutions and this one looked good, but it doesn't work.

Can anyone help or suggest where I'm going wrong?

Anyway, this was what I tried:

1. Create file: ProductController.php


class ProductController extends ProductControllerCore {

    private static function checkProductTemplate($link_rewrite) {
        return file_exists(_PS_THEME_DIR_ . 'templates/' . $link_rewrite . '.tpl');

    public function init() {
        if ($this->template == 'catalog/product.tpl') {
            $id_product = (int) Tools::getValue('id_product');
            $tpl = 'catalog/product_' . $this->product->category;
            if ($this->checkProductTemplate($tpl)) {

                $this->setTemplate($tpl, array(
                    'entity' => 'product',
                    'id' => $id_product,


2. Upload to /override/controllers/front
3. create different product templates
4. add the category's SEO url to the filename, like: 147-ceramics.tpl
5. Upload to theme templates directory, next to the original product.tpl (public_html/themes/classic/templates/catalog/).

This should work for both - categories and subcategories. 

But it doesn't work...


Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More