Table of contents
Integrating content in a page using hooks
Hooks are a way to associate your code to some specific PrestaShop events.
Most of the time, they are used to insert content in a page.
For instance, the PrestaShop default theme's home page has the following hooks:
|Displays the content in the page's header area.
|Displays the content in the page's top area.
|Displays the content in the page's left column.
|Displays the content in the page's central area.
|Displays the content in the page's right column.
Displays the content in the page's footer area.
Hooks can also be used to perform specific actions under certain circumstances (i.e. sending an e-mail to the client).
Existing hooks: front-office
Home page and general site pages
|Called in the page's header.
|Called when loading the left column.
|Called when loading the right column.
|Called in the page's footer.
|Called at the center of the homepage.
|Called right before the "Print" link, under the picture.
|Called right after the block for the "Add to Cart" button.
|Called inside the block for the "Add to Cart" button, right after that button.
|Called inside the block for the "Add to Cart" button, right after the "Availability" information.
|Called right before the tabs.
|Called in tabs list, such as "More info", "Data sheet", "Accessories", etc.
|Called when a tab is clicked.
|Called right after a cart creation or update.
|Called right below the cart items table.
|Called after the cart's table of items, right above the navigation buttons.
|Called within the client account creation form, right above the "Your personal information" block.
|Called within the client account creation form, right before the "Register" button.
|Called right after the client account creation.
|Called on the client account homepage, after the list of available links. Ideal location to add a link to this list.
|Called within the "My account" block, in the left column, below the list of available links. This is the ideal location to add a link to this list.
|Displays extra information inside the "My account" block.
|Called right after the client identification, only if the authentication is valid (e-mail address and password are both OK).
|Called right before authentication.
|Called after a search is performed. Ideal location to parse and/or handle the search query and results.
Carrier choice page
|Displayed before the carrier list on front-office.
|Called after the list of available carriers, during the order process. Ideal location to add a carrier, as added by a module.
|Top of payment page.
|Called when needing to build a list of the available payment solutions, during the order process. Ideal location to enable the choice of a payment module that you have developed.
|Called when the user is sent back to the store after having paid on the 3rd-party website. Ideal location to display a confirmation message or to give some details on the payment.
|A duplicate of paymentReturn.
|Called when displaying the list of available payment solutions. Ideal location to redirect the user instead of displaying said list (i.e., 1-click PayPal checkout).
|Called when the customer request to send his merchandise back to the store, and if now error occurs.
|Called when displaying the invoice in PDF format. Ideal location to display content within the invoice.
Existing hooks: back-office
|Called within the header, above the tabs.
|Called within the page footer, above the "Power By PrestaShop" line.
|Called at the center of the homepage.
Orders and order details
|Called during the new order creation process, right after it has been created.
|Called when an order's status becomes "Payment accepted".
|Called when an order's status is changed, right before it is actually changed.
|Called when an order's status is changed, right after it is actually changed.
|Called when an item is deleted from an order, right after the deletion.
|Called when the order's details are displayed, above the Client Information block.
|Called when the order's details are displayed, below the Client Information block.
|Called during the creation of a credit note, right after it has been created.
|Called when saving products.
|Called during the validation of an order, the status of which being something other than "canceled" or "Payment error", for each of the order's items.
|Called when a product declination is updated, right after said update.
|Called when a product declination is deleted.
|Called when an image is added to a product, right after said addition.
|Add fields to the form "attribute value".
|Add fields to the form "attribute group".
|Called when post-process in admin attribute group.
|Add fields to the form "feature".
|Called when post-process in admin feature.
|Add fields to the form "feature value".
|Called when post-process in admin feature value.
|Called when a stats graph is displayed.
|Called when the grid of stats is displayed.
|Called when the list of stats modules is displayed.
|Called when a client's details are displayed, right after the list of the clients groups the current client belongs to.
|Called during a carrier's update, right after said update.
Visual location of the main hooks
One of the main aspects of integrating content from PrestaShop in your theme is to know where your content will be displayed, and therefore where exactly are the hooks and modules located.
This section presents a visual representation of their location on the home page. It gives you:
- the block's name.
- the block's identifier, in order to properly target it using CSS.
- the block's folder or its template file, should you wish to edit it.
Main content zones