Jump to content

Presta Hooks always execute?


Recommended Posts

Hello,

 

I have a question aobut hooks. Let me give you an example.

I installed module "blockspecials" which is hooked to the "displayRightColumn" and nowhere else. I also searched all my tpl files and there are no "{$HOOK_RIGHT_COLUMN}" anywhere inside. But when I do:

"echo 'test';" inside hookRightColumn function of blockspecials module, the text "test" is visible on every page. Why is that? It's pointless for me because it seems that code of every installed module executes always (tpl files ale unimportant in this case).

Link to comment
Share on other sites

for {$HOOK_RIGHT_COLUMN} - double check footer.tpl file located in your theme directory.

if you use echo "test"; in php file - it will appear always, even if module will not be attached to any hook. 

Main module php files are included always, an always executed.

Link to comment
Share on other sites

because hookProductFooter is a product page hook, and this hook is "executed" in ProductController (controllers/front/ProductController.php).

 

hooks are "executed" in controllers usually, some of them are executed in frontController (classes/controllers/frontController.php) - it mean that these hooks will be execuded on each page in prestashop store. Some of them are executed only on certain pages (controllers)

Link to comment
Share on other sites

×
×
  • Create New...