Prestashop:在屏幕上显示通知

问题描述:

我是Prestashop的新手,我希望在客户注册后显示类似引导警报(成功或危险)的通知。 我尝试了很多解决方案,但徒劳无功。 例如这些代码行不起作用:Prestashop:在屏幕上显示通知

$this->displayWarning($this->l('test')); 
$this->errors[] = Tools::displayError('test'); 
$this->displayInformation('test'); 

任何帮助,请!

+0

如果您使用此代码的进程? – NewUser

+0

我在模块主类中使用这段代码,实际上我在模块 –

+0

上工作然后你需要调用右钩子。调用用户注册后触发的挂钩。 – NewUser

使用$this->context->controller->errors[] = 'test';显示错误。

对于其他类型(信息,警告),您将不得不在手动分配模块钩子数据到smarty。

$this->context->smarty->assign('confirmations', 'Confirm text'); 

然后在你的identity.tpl插入顶部

{if isset($confirmations)} 
    <div class="alert alert-success"> 
     {$confirmations|escape:'htmlall':'utf-8'} 
    </div> 
{/if} 

重复的警告,信息等