matiash Posted January 31, 2014 Share Posted January 31, 2014 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 More sharing options...
vekia Posted January 31, 2014 Share Posted January 31, 2014 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 More sharing options...
matiash Posted January 31, 2014 Author Share Posted January 31, 2014 (edited) Ok so why function "hookProductFooter" of crossseling module executes only on product page - which is logical. I mean what decides when given hook is executed if not "{HOOK_SOMENAME}" in tpl file. Edited January 31, 2014 by matiash (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 31, 2014 Share Posted January 31, 2014 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 More sharing options...
Recommended Posts