自定义挂钩在PrestaShop的后台不可见

时间:2015-03-26 13:08:20

标签: php html hook prestashop

我在PrestaShop中创建了一个模块并将其注册到自定义Hook:

public function install()
{
  if (Shop::isFeatureActive())
    Shop::setContext(Shop::CONTEXT_ALL);

  return parent::install() &&
    $this->registerHook('homeProducts') &&
    $this->registerHook('header') &&
    Configuration::updateValue('MYMODULE_NAME', 'my friend');
} 

[...]

public function hookDisplayHomeProducts($params)
{
  $this->context->smarty->assign(
      array(
          'my_module_name' => Configuration::get('MYMODULE_NAME'),
          'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display')
      )
  );
  return $this->display(__FILE__, 'mymodule.tpl');
}

这个模块适用于本机钩子(例如displayLeftColumn)但是当我创建一个自定义钩子(比如" homeProducts")时,我无法移植我的模块模块到该钩子,因为它在钩子列表中不可见。

如何将此自定义挂钩显示在可用挂钩列表中?

2 个答案:

答案 0 :(得分:2)

我认为你的问题来自你的钩子名称和相关的功能。

如果您使用'display'前缀调用挂钩怎么办:

$this->registerHook('displayHomeProducts')

然后Prestashop会找到相关的函数hookDisplayHomeProducts,你就可以了。

现在,prestashop搜索不存在的hookHomeProducts。

答案 1 :(得分:0)

在数据库中打开表格 ps_hook ,然后设置 live_edit = 1