我正在尝试向 Hook 添加代码,每当客户在我们的商店中成功注册时都会调用该代码。在 Prestashop 文档中显示 Hook 应该是“actionCustomerAccountAdd”。
我的模块的代码如下所示:
<?php
if (!defined('_PS_VERSION_'))
exit;
class SendEmail extends Module
{
public function __construct()
{
$this->name = 'SendEmail';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Philip Zadeh';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.4', 'max' => '1.7');
parent::__construct();
$this->displayName = $this->l('SendEmail');
$this->description = $this->l('Activate to enable activation Emails for new Customers.');
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
if (!Configuration::get('SendEmail_NAME'))
$this->warning = $this->l('No name provided');
}
public function install()
{
return parent::install()
&& $this->createRequiredDBTables()
&& $this->registerHook('actionCustomerAccountAdd');
}
public function hookActionCustomerAccountAdd($params)
{
$this->logger->info('Hook action customer account add fired');
echo 'hook fired';
die();
}
}
?>
第一部分只是模块的基本设置。在安装功能中,我正在添加 Hook。
老实说,我不太确定 createRequiredDBTables 的用途(我只是从另一篇文章中尝试了此代码行,但效果不佳)
在钩子函数中,我试图将代码添加到钩子并基本上记录一些文本。
不幸的是,您可以假设在创建新客户帐户时没有任何反应......
如果有人可以帮助我,我会很高兴
最好的问候,利亚姆
*EDIT actionObjectCustomerAddAfter 也尝试了这个钩子,也没有工作