Prestashop custom layout for specific category

纵然是瞬间 提交于 2019-12-07 01:04:46

Pretty easy to do: override the category controller to set the template.

class CategoryController extends CategoryControllerCore {

    // array with the selected categories
    private $customCategories = array(1, 3);

    public function init() {
        parent::init();

        if (in_array($this->category->id, $this->customCategories)) {
            $this->setTemplate(_PS_THEME_DIR_.'category-custom.tpl');
        }
    }

}

Here you wouldn't be able to change the selected categories from the back office, but it would be easy to do with a module.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!