I've created a module in PrestaShop and registered it to a custom 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');
}
This module works fine with a native hook (for example displayLeftColumn
) but when I create a custom one (like "homeProducts
") then I am unable to transplant my module to that hook, because it's not visible on the list of hooks.
How can I make this custom hook appear in the list of available hooks?
I think your problem come from your hook name and the associated function.
What if you call the hook with the 'display' prefix:
$this->registerHook('displayHomeProducts')
,
then Prestashop will find the associated function hookDisplayHomeProducts, and you will be ok.
Right now, prestashop search for hookHomeProducts which doesn't exists.
Open the table ps_hook in your databes, and set live_edit = 1