我需要在产品页面中隐藏徽标。徽标放在标题HTML中。
所以,在加载模板之前,我尝试在$data['product_page_logo']
控制器中添加新变量header.php
,如:
$ data ['product_page_logo'] = false;
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/header.tpl')) {
return $this->load->view($this->config->get('config_template') . '/template/common/header.tpl', $data);
} else {
return $this->load->view('default/template/common/header.tpl', $data);
}
在header.tpl
之后,我检查了这个变量:
<? if(isset($data['product_page_logo']) && $data['product_page_logo'] == false) {
echo "Logo";
}?>
但它不起作用,我得到错误未定义的变量product_page_logo
答案 0 :(得分:1)
您可以在route
查找:
catalog/controller/common/header.php
$class = '-' . $this->request->get['product_id'];
在添加之前或之后:
$data['logo'] = '';
在opencart 2.3.0.2上测试