从opencart 2.0.3.1中的.tpl文件引用$ this时出错

Ano*_*ous -1 loader opencart

使用vqmod我在header.tpl中注入此代码.

<?php if ($this->customer->isLogged()){ if($this->customer->getCustomerGroupId()!=1) { ?>
              //show something

<?php } ?>
Run Code Online (Sandbox Code Playgroud)

它在opencart 1.5.6.1中运行良好但是现在我更新到2.0.3.1并且我收到此错误:

Notice: Undefined property: Loader::$customer in C:\UniServerZ\www\opencart-2.0.3.1\upload\vqmod\vqcache\vq2-catalog_view_theme_default_template_common_header.tpl
Run Code Online (Sandbox Code Playgroud)

有没有办法从2.0.3.1中的.tpl文件中引用$ this?

Tan*_*moy 5

你不能从tpl调用customer class,你已经header.php, 将数据存储到$this->data[]tpl文件中并在tpl文件中使用它.那将是正确的程序.