O'Reilly logo

PrestaShop Module Development by Fabien Serny

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a hook

You might want, at some points, to add your own hooks. In PrestaShop 1.5/1.6, you do not need to add it manually in your database to create a new hook anymore. In fact, you just have to place your hook's trigger in the PHP file or template file you want (with the same syntax described at the beginning of the Triggering hooks section), and then attach the module to the new hook with the registerHook method.

The registerHook method will automatically create the hook in the database if it does not already exist. It is not as efficient as an event listener system you can find in other frameworks, but it's still powerful and effective.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required