php - 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();
}
谢谢你。
解决方案
问题是钩子actionCustomerAccountAdd
只在前台触发,你需要使用actionObjectCustomerAddAfter
, 执行的动态钩子classes/ObjectModel.php
推荐阅读
- javascript - 刷新后JavaScript未定义变量
- spring - antMatcher 和 mvcMatcher 的区别
- java - 如何从 CSV 文件中获取特定数据
- python - 如何读取 DataFrame 中的特定单元格并写入其中
- flutter - flutter google_sign_in crash : __exceptionPreprocess + 294
- c# - C# itext pdf 创建者希腊字体不显示
- assembly - Why does my register print a value on its own (without using any system call)?
- swift - Swift & Firebase - Split data for user info?
- oracle - Currently Executing Procedure Name within the Package
- azure - 如何在 Application Insights Analytics 中对图表/箱进行零填充