我想在Opencart 1.5.4中设置其他页面和类别布局.
我已进入一个阶段,如果我将新类别的路径输入地址栏,新模板会显示我想要的,但我似乎无法在OC中注册该路由更改.
如果我在.htaccess文件中指定了更改,则新模板会按预期加载,但我不是这个问题的正确答案(尽管它有效).
添加.htaccess(我确定不是正确的方法)
RewriteRule ^skis$ index.php?route=product/categories&path=1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)
我创建了两个新文件
/catalog/view/theme/default/template/product/categories.tpl
/catalog/controller/product/categories.php
Run Code Online (Sandbox Code Playgroud)
在/catalog/controller/product/categories.php中,我更改了内容以反映新的tpl文件;
class Controllerproductcategories extends Controller {
Run Code Online (Sandbox Code Playgroud)
.
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/categories.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/categories.tpl';
} else {
$this->template = 'default/template/product/categories.tpl';
}
Run Code Online (Sandbox Code Playgroud)
所以总结一下
任何人都有任何想法,我可能会试图让这个正常工作?我有大量模板可以为产品,类别和信息页面创建,因此我们希望正确地执行此操作.
Tx提前
斯图
我最终选择了这种方法..可能会帮助别人.
if ($this->data['heading_title'] == "Skis") {
$this->template = $this->config->get('config_template') . '/template/product/categories.tpl';
} elseif ($this->data['heading_title'] == "Softgoods") {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} elseif ($this->data['heading_title'] == "Outlet Store") {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
} else {
$this->template = $this->config->get('config_template') . '/template/product/category.tpl';
}
Run Code Online (Sandbox Code Playgroud)