In Prestashop 1.4 when you were addding new hook, you had to insert the hook into 'ps_hook' database table and then create override for FrontController.php. Since Prestashop 1.5, you can create the new hook directly in your module and then use it anywhere in your theme or in your module.

Here is an example for own module with custom hook.

First you have to registrer the hook in the install function of the module. This module will be using default hook 'leftColumn' and register new hook 'myCustomHook':

 public function install() { if (!parent::install() || !$this->registerHook('leftColumn') || !$this->registerHook('myCustomHook')) return false; return true; }

Then you have to create function to define what will be displayed in this hook, here it will be content of nameofmynewmodule.tpl file:

 public function hookMyCustomHook($params) { return $this->display(__FILE__, 'nameofmynewmodule.tpl'); } 

Now you can add the new hook into any tpl file of your theme, e.g. header.tpl. It will display the content of nameofmynewmodule.tpl

 {hook h='myCustomHook'} 


This website uses cookies to enable it to perform properly. Details of the cookies and instructions on how to disable them can be found in the cookie policy. By using this website, you agree to our use of cookies.