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
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Registering our module on hooks


In your module, you will have to create an install method and register all the hooks you want your module to be attached to in the method. In the case of the module we started in the previous chapter, we want to display grades and comments on product pages, so we have to attach the module to one of the hooks that are available on the product page, such as displayProductTabContent.

Note

The displayProductTabContent hook is a hook that permits to display content at the end of the product page. The exhaustive list of native hooks is available at the end of this book.

We will add the displayProductTabContent hook with the help of the following code:

public function install()
{
  parent::install();
  $this->registerHook('displayProductTabContent');
  return true;
}

The parent install method is doing some pretty important processes, such as adding the module in the ps_module SQL table. So if you don't call it in your own install method, your module won't be installable...