Prestashop 1.7.X 钩子在用户进行注册时不触发



我正在Prestashop 1.7.X中创建一个自定义模块,我想在用户在商店中注册时获取用户的所有详细信息。因此,我正在使用actionCustomerAccountAdd钩子。但是这个钩子在 Prestashop 1.7.X 中没有发射。当我在prestashop 1.6.X中使用相同的钩子时,它可以毫无问题地工作。

这是我的示例代码

if (!defined('_PS_VERSION_')) {
    exit;
}
class Hellouser extends Module
{
    protected $config_form = false;
    public function __construct()
    {
        $this->name = 'hellouser';
        $this->tab = 'other';
        $this->version = '1.0.0';
        $this->author = 'test';
        $this->need_instance = 0;
        $this->module_key = '';
        parent::__construct();
        $this->bootstrap = 'true';
        $this->displayName = $this->l('Hello User');
        $this->description = $this->l('This is the demo module');
        $this->confirmUninstall = $this->l('Are you sure you want to uninstall module?');
        $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
        $this->js_path = $this->_path.'views/js/';
        $this->css_path = $this->_path.'views/css/';
        $this->img_path = $this->_path.'views/img/';
        $this->logo_path = $this->_path.'logo.png';
        $this->module_path = $this->_path;
    }
    public function install()
    {
        if (!parent::install() || 
            !$this->registerHook(
                array('actionCustomerAccountAdd')))
            return false;
    }
    public function uninstall()
    {
        return parent::uninstall();
    }

    public function hookActionCustomerAccountAdd($params) {
        print_r($params);
        exit;
    }
}

试试这个编辑

public function install()
{
    if (!parent::install() || 
        !$this->registerHook('actionCustomerAccountAdd'))
        return false;
    return true;
}

最新更新