用户注册时Prestashop 1.7.X挂钩未触发

时间:2019-04-16 07:51:22

标签: prestashop prestashop-1.7

我正在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;
    }
}

1 个答案:

答案 0 :(得分:0)

尝试一下 编辑

onSubmit(): void 
{
    // the lines I added
    const bf = BookService.BookForm;
    bf.patchValue({ ID: 'anyIdYouLike' });

    // what stays the same (except the bf.value shortened version)
    BookService.UpdateBook(bf.value).subscribe(
       b => alert(`Book Updated Successfully`),
       err => alert(`Exception While Updating: ${err}`) 
 );
}