我使用PS 1.6.1.1,我想覆盖MyAccountController
在我的tpl文件中添加新的var。覆盖MyAccountController Prestashop
创建我的override/controllers/front/MyAccountController
与文件:
class MyAccountControllerCore extends FrontController
public function initContent()
{
$smarty = new Smarty;
$smarty->assign('firstname', 'Doug');
$this->setTemplate(_PS_THEME_DIR_.'my-account.tpl');
}
}
当我在TPL文件中调用<span>{$firstname}</span>
,无法正常工作。
我删除cache/class_index.php
任何想法?
谢谢!
是的,最后回答帮助了我。你知道是否有可能在'MyAccountController'中获得客户群? – Reitrac
Yes add: $ this-> context-> smarty-> assign('listgroup',$ this-> context-> customer-> getGroups()); – ethercreation
它的工作,谢谢,另一个小问题,是否有可能在smarty添加如果条件与PHP VAR?例如{if {$ groupe} == 1}? – Reitrac