How to add prestashop hook
Prestashop is a popular open source ecommerce application with several features and possibilities of extension. Extension of prestashop requires the use of modules. These modules add new features or extend existing features. To modify existing features or perform some actions at a particular stack in Prestashop, you will need to use hooks. Most modules depends entirely on hooks to work.
There are two types of Prestashop hooks,
1) Action Hook
2) Display Hook
Actions hooks performs a particular action at a particular event in Prestashop. Example of action hook is “actionValidateOrder”. This action hook is called when order is validated by a payment module. This hook can be found in PaymentModule class.
Display hooks is used to add content on the backoffice or frontoffice. Several sections of prestashop frontoffice or backoffice depends on the hook to display appropriate content. This provides opportunity for the module develop to add extra content to the page.
Example of display hook is “displayHeader”
Adding Prestashop hook to a module
You can register prestashop hook in the module install method and call the hook method inside your module class
public function install()
return parent::install() && $this->registerHook('displayHeader') && $this->registerHook('actionValidateOrder');
* Display hook
public function hookDisplayHeader()
// Do all you want in the header here
public function hookActionValidateOrder($params)
//Some hooks has parameters
// Perform all action here
Leave a Comment