Content management system Prestashop模块开发-为什么此模板重定向不起作用

Content management system Prestashop模块开发-为什么此模板重定向不起作用,content-management-system,prestashop,prestashop-1.6,Content Management System,Prestashop,Prestashop 1.6,在用户注册确认时,我想显示一个简单的弹出窗口。目前,为了简化,我很高兴展示一个“你好世界” 这是模板文件,views/templates/hook/registrationConfirm.tpl <div id="idname" class="block"> <h1 class="title_block">HelloWorld</h1> </div> 它没有显示任何内容(我还尝试检查了呈现页面的源代码,但没有找到“HelloWorld”)以

在用户注册确认时,我想显示一个简单的弹出窗口。目前,为了简化,我很高兴展示一个“你好世界”

这是模板文件,views/templates/hook/registrationConfirm.tpl

<div id="idname" class="block">
   <h1 class="title_block">HelloWorld</h1>
</div>
它没有显示任何内容(我还尝试检查了呈现页面的源代码,但没有找到“HelloWorld”)

以“Action”开头的钩子对某个操作作出反应,但不显示任何内容,但以“display”开头的钩子会显示任何内容

您还应该对钩子显示CustomerAccount作出反应

public function hookActionCustomerAccountAdd() {
    $this->is_new_account = true;
}

public function hookDisplayCustomerAccount()
{
    if ($this->is_new_account) {
        return $this->display(__FILE__, 'registrationConfirm.tpl');
    }
}
以“Action”开头的钩子会对某个动作做出反应,但不会显示任何内容,但以“display”开头的钩子会显示任何内容

您还应该对钩子显示CustomerAccount作出反应

public function hookActionCustomerAccountAdd() {
    $this->is_new_account = true;
}

public function hookDisplayCustomerAccount()
{
    if ($this->is_new_account) {
        return $this->display(__FILE__, 'registrationConfirm.tpl');
    }
}

我尝试了@shagshag发布的解决方案,但由于某种原因,它对我不起作用。因此,我分享了我的解决方案(我认为它不漂亮,也不高效,但似乎对我有用):在hookActionCustomerAccountAdd中,我将电子邮件和客户id保存在自定义表(newCustomersTmp)中,因为这些是我需要的数据,在显示挂钩中。然后在hookDisplayCustomerAccount中,我检查当前电子邮件($this->context->customer->email)的用户是否已经存在于我的表中:如果已经存在,我检索数据,对他们执行我需要的操作并删除表中的行。

我尝试了@shag发布的解决方案,但由于某种原因它对我不起作用。因此,我分享了我的解决方案(我认为它不漂亮,也不高效,但似乎对我有用):在hookActionCustomerAccountAdd中,我将电子邮件和客户id保存在自定义表(newCustomersTmp)中,因为这些是我需要的数据,在显示挂钩中。然后在hookDisplayCustomerAccount中,我检查当前电子邮件($this->context->customer->email)的用户是否已经存在于我的表中:如果已经存在,我将检索数据,对他们执行所需的操作并删除表中的行。

此$this包含什么?在真实的情况下,当成千上万的人访问网站时,如何确保“is_new_account”值不混合?在模块上下文中,
$this
是当前模块
$this->is_new_account
仅为当前执行设置,如果相同(或其他)访客在同一时刻(或其他时刻)运行相同的脚本,他将拥有另一个
$this->is\u new\u帐户
,感谢您的解释。我在想它为什么不起作用。PS 1.6是否支持此功能?“$this”包含什么内容?在真实的情况下,当成千上万的人访问网站时,如何确保“is_new_account”值不混合?在模块上下文中,
$this
是当前模块
$this->is_new_account
仅为当前执行设置,如果相同(或其他)访客在同一时刻(或其他时刻)运行相同的脚本,他将拥有另一个
$this->is\u new\u帐户
,感谢您的解释。我在想它为什么不起作用。PS 1.6是否支持这一点?