Prestashop 1.7 Hook actionCustomerAccountAdd未触发

我试图在自定义模块中添加一个挂钩,但是在prestashop后台或使用Web服务添加客户之后,都不会触发该挂钩。

我要注册的钩子名称是“ actionCustomeraccountAdd”。

这是模块的相关代码。请你能帮我吗?我是PHP开发人员,但这是我第一次在Prestashop方面进行开发。

/**
     * Don't forget to create update methods if needed:
     * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
     */
    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();
    }

谢谢。

iCMS 回答:Prestashop 1.7 Hook actionCustomerAccountAdd未触发

问题是,钩子actionCustomerAccountAdd仅在前台被触发,您将需要使用actionObjectCustomerAddAfter,在classes/ObjectModel.php中执行的动态钩子

本文链接:https://www.f2er.com/1774879.html

大家都在问