Book Image

PrestaShop Module Development

By : Fabien Serny
Book Image

PrestaShop Module Development

By: Fabien Serny

Overview of this book

Table of Contents (19 chapters)
PrestaShop Module Development
About the Author
About the Reviewers

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.