dpepbjp126917 2018-09-21 16:37
浏览 82

后台办公室钩子即使被解雇也没有运行

So, recently i started to work with Presta and everything on the front office flew perfectly, but in the back office dificulties appeared.

I'm trying to hook to an action ActionAdminCustomerFormModifier which is fired in AdminController.php like this Hook::exec('action'.$this->controller_name.'FormModifier', array(... where action'.$this->controller_name.'FormModifier stands for actionAdminCustomersFormModifier.

As a good kid i registered it ($this->registerHook('actionAdminCustomersFormModifier') like every other hook for front office), created a function in main module class (public function hookActionAdminCustomersFormModifier) but, to my horror, it has never run.

I'm using PrestaShop 1.7.4


SOLUTION

So I just made public function hookActionAdminFormModifier and registered it actionAdminControllerFormModifier and reuploaded it. My problem was, i think, I had connected my IDE directly to the presta server and probably it had some problems when i registered a new hook. So I have reinstalled my module and everything flew like a charm.

  • 写回答

1条回答 默认 最新

  • dousong3760 2018-09-21 17:09
    关注

    In prestashop 1.7 they have updated list of hooks; full list available here

    As you are trying to use hook named action<AdminControllerName>FormModifier and you want to use it for controller AdminCustomers; it seems you should use full controller name like AdminCustomersController instead.

    So you should register your hook first in install() method as below;

    $this->registerHook('actionAdminCustomersControllerFormModifier')
    

    and you need to make function named

    public function hookActionAdminCustomersControllerFormModifier()
    

    After making changes please reset your module, so new hook should register itself.

    Hope this will be useful for you!

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测