Add New Hook In Prestashop

Prestashop
PrestaShop hooks are great way to insert or add data at the most important places or actions of this great e-commerce platform. But may be some time you want to use custom hooks with my custom modules. So here I show you how to implement custom hook? How to create custom hook? Step 1: Register a new hook in FrontController.php open file \classes\FrontController.php and find below code [php] self::$smarty->assign(array( 'HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn') )); [/php] Updated code For add new hook I add this line of code [php]'HOOK_Top_Center' => Module::hookExec('topCenter') // New Hook [/php] So you code look like below. [php] self::$smarty->assign(array( 'HOOK_HEADER' => Module::hookExec('header'), 'HOOK_TOP' => Module::hookExec('top'), 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'), 'HOOK_Top_Center' => Module::hookExec('topCenter') )); [/php] Step 2: All active hooks are hold in Prestashop…
Read More