2017-04-22 23:56
浏览 58


I'm working on my own store, and I want to add some custom functionality. But this functionality is not something standalone, so I'd prefer to completely implemented via overriding controllers/classes and not to create a separate module for this.

But I have to use some hooks (for example - displayAdminProductsExtra to add new tab to admin product page, or actionProductAdd/actionProductUpdate to make some custom edits to DB). I know the way to use hooks from within the modules, but I cant find the way to do without creating my own module).

So the question - is there a way to do so?

Thanks in advance.

图片转代码服务由CSDN问答提供 功能建议

我正在自己的商店工作,我想添加一些自定义功能。 但是这个功能不是独立的,所以我更喜欢通过覆盖控制器/类完全实现,而不是为此创建一个单独的模块。

但我必须使用一些钩子( 例如 - displayAdminProductsExtra将新选项卡添加到admin产品页面,或者actionProductAdd / actionProductUpdate对DB进行一些自定义编辑。 我知道在模块中使用钩子的方法,但是我无法在不创建自己的模块的情况下找到方法。)

所以问题 - 是否有办法这样做?


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqz30992 2017-04-24 07:56

    Hooks are only meant to be used with modules.

    When Hook::exec() is called it will first check if a module is attached to this hook and stop otherwise.

    Here is the related code:

    // If no modules associated to hook_name or recompatible hook name, we stop the function
    if (!$module_list = Hook::getHookModuleExecList($hook_name)) {
        return '';
    打赏 评论

相关推荐 更多相似问题