所有模块的Prestashop寄存器公共挂钩

所有模块的Prestashop寄存器公共挂钩,prestashop,prestashop-1.6,Prestashop,Prestashop 1.6,我的prestashop 1.6主题和模块有问题。我需要为我的主题注册几个钩子(位置)。为了主题,我创建了自己的插件,并在其中添加以下内容: public function install() { Configuration::updateValue('TESTRTVTHEME_LIVE_MODE', false); return parent::install() && $this->registerHook('header') &

我的prestashop 1.6主题和模块有问题。我需要为我的主题注册几个钩子(位置)。为了主题,我创建了自己的插件,并在其中添加以下内容:

public function install()
{
    Configuration::updateValue('TESTRTVTHEME_LIVE_MODE', false);

    return parent::install() &&
        $this->registerHook('header') &&
        $this->registerHook('backOfficeHeader') &&
        $this->registerHook('testHomeSearch') &&
        $this->registerHook('testHomeBasket') &&
        $this->registerHook('testMenu1') &&
        $this->registerHook('testMenu2') &&
        $this->registerHook('testMenu3') &&
        $this->registerHook('testMenu4') &&
        $this->registerHook('testMenu5') &&
        $this->registerHook('testMenu6') &&
        $this->registerHook('displayTwMenu6') &&
        $this->registerHook('testMenu7')
        ;
}
接下来,我将这些行添加到主题中:

{hook h='displayLeftColumnZ' mod='blockcart'}
好的,现在我需要添加自定义地点/位置以在我的主题中显示购物车,我尝试注册主题挂钩并显示它,但它不起作用:(


您能告诉我如何添加自定义位置、向其中添加模块并在主题中的自定义位置显示吗?

最简单的方法如下:

  • 在DB表ps_hooks中添加一个条目,其中包含所需的所有信息
  • 在您的主题(例如product.tpl)中,使用{hook h='myHook'}调用您的钩子
  • 在模块中,将以下函数添加到主文件(mymodule.php):

    公共函数hookMyHook($params){}

  • 然后,您只需在这个函数中编写渲染,就可以了


    模块的
    install()
    函数中的
    $this->registerHook('myHook')
    行没有声明新的挂钩,而是自动将模块挂钩到此位置。

    最简单的方法如下:

  • 在DB表ps_hooks中添加一个条目,其中包含所需的所有信息
  • 在您的主题(例如product.tpl)中,使用{hook h='myHook'}调用您的钩子
  • 在模块中,将以下函数添加到主文件(mymodule.php):

    公共函数hookMyHook($params){}

  • 然后,您只需在这个函数中编写渲染,就可以了

    模块的
    install()
    函数中的
    $this->registerHook('myHook')
    行没有声明新的挂钩,而是自动将模块挂钩到此位置