Prestashop custom layout for specific category

南楼画角 提交于 2019-12-23 02:55:14

问题


Can I have a specific category layout for selected categories? The detail page will be the same, I need to get a custom tpl file.

Thanks for suggestions


回答1:


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.



来源:https://stackoverflow.com/questions/18875349/prestashop-custom-layout-for-specific-category

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