特定类别的 Prestashop 自定义布局 [英] Prestashop custom layout for specific category
本文介绍了特定类别的 Prestashop 自定义布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以为选定的类别设置特定的类别布局吗?详细信息页面将相同,我需要获取自定义 tpl 文件.
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.
感谢您的建议
推荐答案
很容易做到:覆盖类别控制器以设置模板.
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.
这篇关于特定类别的 Prestashop 自定义布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文