我使用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