1

我可以为选定的类别设置特定的类别布局吗?详细页面将是相同的,我需要获取一个自定义 tpl 文件。

感谢您的建议

4

1 回答 1

3

很容易做到:覆盖类别控制器来设置模板。

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');
        }
    }

}

在这里,您将无法从后台更改所选类别,但使用模块很容易做到。

于 2013-09-18T23:16:07.213 回答