User Tools

Site Tools


prestashophelp:hookmodule

Hook module to another position

If you want to add/move the module to another position but see the message 'This module cannot be transplanted to this hook.' you can modificate the module and add it to the position you need.
1) Back-office>Modules>Positions
Find the hook of the module that you need to move. Example:
displayHome
displayFooter
displayTop

2) Copy the name of the hook where the module is located.
Remember! displayHeader is a system hook(for scripts and css). Don't copy it
3) Go to the module folder your_site/modules/some_module
and there in the end of the file some_module.php before the last '}' paste the code:

public function hookTargetHook($params) {
   return $this->hookSourceHook('targetHook');
}

hook - system name. It should be always there
targetHook - Hook where you want to move the module.
sourceHook - The module hook where it's located by default.


Here is an example (block newsletter to the footer) of how you can do that:

With this help http://englove.blogspot.com/2012/01/prestashop-this-module-cannot-be.html I corrected the file \modules\blocknewsletter\blocknewsletter.php Added the code there:

  public function hookDisplayFooter($params) 
    { return $this->hookDisplayLeftColumn('displayFooter');   }

hookDisplayLeftColumn - this is source hook
displayFooter - this is target hook

Now I can add it to the footer.

prestashophelp/hookmodule.txt · Last modified: 2013/10/18 05:45 (external edit)