...
Table of Contents | ||
---|---|---|
|
Hooks in PrestaShop 1.5
Hooks in PrestaShop 1.5 have a new naming scheme, with a situation-specific prefix:
- action. These hooks are triggered by specific events that take place in PrestaShop.
- display. These hooks result in something being displayed, either in the front-end or the back-end.
This way, you will know right away what type of hook you are dealing with. Older hooks have been renamed to match this scheme.
...
New & updated hooks since v1.4
All hooks in PrestaShop have been updated for version 1.5, and several new ones were added.
New hooks since v1.4
Hook name | Hook description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionAdminMetaControllerUpdate_optionsBefore | ||
actionAdminMetaSave | After save saving configuration in AdminMeta. | |
actionAttributeDelete | On deleting attribute feature value | |
actionAttributeGroupDelete | On deleting attribute group | |
actionAttributeGroupSave | On saving attribute group | |
actionAttributePostProcess | On post-process in admin feature value | |
actionAttributeSave | On saving attribute feature value | |
actionAuthentication |
| |
N/A | ||
actionAuthentication | After authentication. | N/A |
actionBeforeAuthentication | Before authentication. | |
actionCarrierProcess |
| |
actionCarrierUpdate | This hook is called when a carrier is updated | |
actionCartSave |
| |
actionCategoryAdd |
| |
actionCategoryDelete |
| |
actionCategoryUpdate |
| |
N/A | ||
actionCartSave | After saving the Cart object. | N/A |
actionCustomerAccountAdd | Called when a new customer create customer successfully creates account successfuled | |
actionFeatureDelete | On deleting attribute feature | |
actionFeatureSave | On saving attribute feature | |
actionFeatureValueDelete | On deleting attribute feature value | |
actionFeatureValueSave | On saving attribute feature value | |
actionHtaccessCreate | After htaccess creation | |
actionObjectCategoryDeleteAfter |
| |
actionObjectCategoryUpdateAfter |
| |
actionObjectCmsDeleteAfter |
| |
actionObjectCmsUpdateAfter |
| |
actionObjectManufacturerDeleteAfter |
| |
actionObjectManufacturerUpdateAfter |
| |
actionObjectProductDeleteAfter |
| |
actionObjectProductUpdateAfter |
| |
actionObjectSupplierDeleteAfter |
| |
actionObjectSupplierUpdateAfter |
| |
. |
| |
actionHtaccessCreate | After .htaccess creation. | N/A |
actionObjectCategoryDeleteAfter | Not invoked by the PrestaShop core itself - can be used after deleting a category to notify the Horizonal Top Menu. | N/A |
actionObjectCategoryUpdateAfter | Not invoked by the PrestaShop core itself - can be used after updating a category to notify the Horizontal Top Menu. | N/A |
actionObjectCmsDeleteAfter | Not invoked by the PrestaShop core itself - can be used after deleting a CMS page to notify the Horizontal Top Menu. | N/A |
actionObjectCmsUpdateAfter | Not invoked by the PrestaShop core itself - can be used after deleting a CMS page to notify the Horizontal Top Menu. | N/A |
actionObjectManufacturerDeleteAfter | Not invoked by the PrestaShop core itself - can be used after deleting a manufacturer to notify the Horizontal Top Menu. | N/A |
actionObjectManufacturerUpdateAfter | Not invoked by the PrestaShop core itself - can be used after updating a manufacturer to notify the Horizontal Top Menu. | N/A |
actionObjectProductDeleteAfter | Not invoked by the PrestaShop core itself - can be used after deleting a product to notify the Horizontal Top Menu. | N/A |
actionObjectProductUpdateAfter | Not invoked by the PrestaShop core itself - can be used after updating a product to notify the Horizontal Top Menu. | N/A |
actionObjectSupplierDeleteAfter | Not invoked by the PrestaShop core itself - can be used after deleting a supplier to notify the Horizontal Top Menu. | N/A |
actionObjectSupplierUpdateAfter | Not invoked by the PrestaShop core itself - can be used after updating a supplier to notify the Horizontal Top Menu. | N/A |
actionOrderDetail | To set the follow-up in smarty Smarty when order detail is called. | |
actionOrderReturn |
| |
| ||
actionOrderReturn | Called after a new Order Return has been made. |
|
actionOrderSlipAdd | Called when a the quantity of one a product change changes in an order. | |
actionOrderStatusPostUpdate |
| |
actionOrderStatusUpdate | Launch modules when the order's status of an order change. | |
actionPaymentCCAdd | Payment CC added | |
actionPaymentConfirmation |
| |
actionProductAdd |
| |
actionProductAttributeDelete |
| |
actionProductAttributeUpdate |
| |
actionProductCancel | This hook is called when you cancel a product in an order | |
actionProductDelete | This hook is called when a product is deleted | |
actionProductListOverride | Assign product list to a category | |
actionProductOutOfStock | Make action while product is out of stock | |
actionProductSave | On saving products | |
actionProductUpdate |
| |
actionSearch |
| |
actionShopDataDuplication |
| |
actionTaxManager |
| |
actionUpdateQuantity | Quantity is updated only when the customer effectively place his order. | |
actionValidateOrder |
| |
actionWatermark |
| |
displayAdminCustomers | Launch modules when the tab AdminCustomers is displayed on back-office. | |
displayAdminOrder | Launch modules when the tab AdminOrder is displayed on back-office. | |
displayAdminStatsGraphEngine |
| |
displayAdminStatsGridEngine |
| |
displayAdminStatsModules |
| |
displayAttributeForm | Add fields to the form "attribute value" | |
displayAttributeGroupForm | Add fields to the form "attribute group" | |
displayAttributeGroupPostProcess | On post-process in admin attribute group | |
displayBackOfficeFooter |
| |
displayBackOfficeHeader |
| |
displayBackOfficeHome |
| |
displayBackOfficeTop |
| |
displayBeforeCarrier | This hook is display before the carrier list on Front office | |
WARNING: only invoked when a product is actually removed from an order. |
The order of IDs and quantities is important! | |
actionOrderStatusPostUpdate | Called after the status of an order changes. |
|
actionOrderStatusUpdate | Called before the status of an order changes. |
|
actionPaymentCCAdd | Payment CC added |
|
actionPaymentConfirmation | Called after a payment has been validated |
|
actionSearch | After the search in the store. Includes both instant and normal search. |
|
actionShopDataDuplication | After duplicating a shop. |
|
actionTaxManager | Not used by PrestaShop core. | N/A |
actionUpdateQuantity | After updating the quantity of a product. |
|
actionValidateOrder | After an order has been validated. Doesn't necessarily have to be paid. |
|
actionWatermark | After a watermark has been added to an image. |
|
displayAdminCustomers | Can be used by modules when the tab AdminCustomers is displayed in the Back Office. | array( |
displayAdminOrder | Can be used by modules when the tab AdminOrder is displayed in the Back Office. | array( |
displayAdminStatsGraphEngine | Not used by PrestaShop core. | N/A |
displayAdminStatsGridEngine | Not used by PrestaShop core. | N/A |
displayAdminStatsModules | Used when the statistics page in the Back Office is shown. | N/A |
displayBackOfficeFooter | Displayed right before the Back Office footer. | N/A |
displayBackOfficeHeader | Displayed between the <head></head> tags on every Back Office page (when logged in). | N/A |
displayBackOfficeHome | Displayed on the dashboard page of the Back Office. | N/A |
displayBackOfficeTop | Shown above the actual content of a Back Office page | N/A |
displayBeforeCarrier | This hook is displayed before the carrier list on the Front Office | array( NOTE: intified means an array of integers 'intified' by |
displayBeforePayment | Redirect user to the module instead of displaying payment modules | |
displayCarrierList |
| |
| ||
displayCarrierList | Display extra carriers in the carrier list. |
|
displayCustomerAccount | Display on page account of the customer. | N/A |
displayCustomerAccountForm | Display some information on the form to create a customer account. | N/A |
displayCustomerAccountFormTop |
| |
displayFeatureForm | Add fields to the form "feature" | |
displayFeaturePostProcess | On post-process in admin feature | |
displayFeatureValueForm | Add fields to the form "feature value" | |
displayFeatureValuePostProcess | On post-process in admin feature value | |
Display some information on the top of the form to create a customer account. | N/A | |
displayFooter | Add block in footer. | N/A |
displayFooterProduct | Add new blocks under the product description. | N/A |
displayHeader | A hook which allow you to do things in the header of each pages | |
displayHome |
| |
every page. | N/A | |
displayHome | Display on content of home page. | N/A |
displayInvoice | Add blocks to invoice (order). | N/A |
displayLeftColumn |
| |
displayLeftColumnProduct |
| |
Display in left column. | N/A | |
displayLeftColumnProduct | Display in left column on product page (not to be confused with the general left column). | N/A |
displayMyAccountBlock | Display extra informations information inside the "my account" block | N/A |
displayMyAccountBlockfooter | Display extra informations information inside the "my account" block | N/A |
displayOrderConfirmation | Called on order confirmation page |
|
displayOrderDetail | Displayed on order detail on front office | |
displayPDFInvoice | Allow the display of extra informations into the PDF invoice | |
displayPayment |
| |
displayPaymentReturn |
| |
| ||
displayPayment | Displayed on payment page | N/A |
displayPaymentReturn | Displayed on payment return page |
|
displayPaymentTop | Top of payment page | N/A |
displayPDFInvoice | Allow the display of extra information into the PDF invoice | N/A |
displayProductButtons | Put new action buttons on product page | N/A |
displayProductComparison | Extra Product Comparison | N/A |
displayProductTab | Called on order product page tabs | N/A |
displayProductTabContent | Called on order product page tabs | |
displayRightColumn |
| |
displayRightColumnProduct |
| |
| ||
displayRightColumn | Displayed in right column. |
Note that the |
displayRightColumnProduct | Display in right column on product page (not to be confused with the general right column). | N/A |
displayShoppingCart | Display some specific informationsinformation | array( Can be found in |
displayShoppingCartFooter | Display some specific informations information on the shopping cart page | |
displayTop | A hook which allow you to do things a the top of each pages. |
...
array( Can be found in |
Updated hooks since v1.4
Most of these hooks are the same as they were in version 1.4 of PrestaShop, but have been renamed with either a an "action" or "display" prefix in order to be compatible with the new 1.5 naming scheme.
Note |
---|
The following "updated hooks" lists were automatically generated by a script. Hook descriptions appear as they are in the PrestaShop database, and can sometimes be missing. |
Old hook name | New hook name | Hook description |
---|---|---|
AdminStatsModules | displayAdminStatsModules |
|
GraphEngine | displayAdminStatsGraphEngine |
|
GridEngine | displayAdminStatsGridEngine |
|
PDFInvoice | displayPDFInvoice | Allow the display of extra informations information into the PDF invoice |
addproduct | actionProductAdd |
|
adminCustomers | displayAdminCustomers | Launch modules when the tab AdminCustomers is displayed on back-office. |
adminOrder | displayAdminOrder | Launch modules when the tab AdminOrder is displayed on back-office. |
afterCreateHtaccess | actionHtaccessCreate | After |
afterDeleteAttribute | actionAttributeDelete | On deleting attribute feature value |
afterDeleteAttributeGroup | actionAttributeGroupDelete | On deleting attribute group |
afterDeleteFeature | actionFeatureDelete | On deleting attribute feature |
afterDeleteFeatureValue | actionFeatureValueDelete | On deleting attribute feature value |
afterSaveAdminMeta | actionAdminMetaSave | After save configuration in AdminMeta |
afterSaveAttribute | actionAttributeSave | On saving attribute feature value |
afterSaveAttributeGroup | actionAttributeGroupSave | On saving attribute group |
afterSaveFeature | actionFeatureSave | On saving attribute feature |
afterSaveFeatureValue | actionFeatureValueSave | On saving attribute feature value |
afterSaveProduct | actionProductSave | On saving products |
attributeForm | displayAttributeForm | Add fields to the form "attribute value" |
attributeGroupForm | displayAttributeGroupForm | Add fields to the form "attribute group" |
authentication | actionAuthentication |
|
backBeforePayment | displayBeforePayment | Redirect user to the module instead of displaying payment modules |
backOfficeFooter | displayBackOfficeFooter |
|
backOfficeHeader | displayBackOfficeHeader |
|
backOfficeHome | displayBackOfficeHome |
|
backOfficeTop | displayBackOfficeTop |
|
beforeAuthentication | actionBeforeAuthentication | Before authentication |
beforeCarrier | displayBeforeCarrier | This hook is display before the carrier list on Front office |
cancelProduct | actionProductCancel | This hook is called when you cancel a product in an order |
cart | actionCartSave |
|
categoryAddition | actionCategoryAdd |
|
categoryDeletion | actionCategoryDelete |
|
categoryUpdate | actionCategoryUpdate |
|
createAccount | actionCustomerAccountAdd | Called when a new customer create successfully creates an account successfuled |
createAccountForm | displayCustomerAccountForm | Display some information on the form to create a customer account |
createAccountTop | displayCustomerAccountFormTop |
|
customerAccount | displayCustomerAccount | Display on page account of the customer |
deleteProductAttribute | actionProductAttributeDelete |
|
deleteproduct | actionProductDelete | This hook is called when a product is deleted |
extraCarrier | displayCarrierList |
|
extraLeft | displayLeftColumnProduct |
|
extraProductComparison | displayProductComparison | Extra Product Comparison |
extraRight | displayRightColumnProduct |
|
featureForm | displayFeatureForm | Add fields to the form "feature" |
featureValueForm | displayFeatureValueForm | Add fields to the form "feature value" |
footer | displayFooter | Add block in footer |
header | displayHeader | A hook which allow you to do things in the header of each pages |
home | displayHome |
|
invoice | displayInvoice | Add blocks to invoice (order) |
leftColumn | displayLeftColumn |
|
myAccountBlock | displayMyAccountBlock | Display extra informations information inside the "my account" block |
newOrder | actionValidateOrder |
|
orderConfirmation | displayOrderConfirmation | Called on order confirmation page |
orderDetail | actionOrderDetail | To set the follow-up in smarty Smarty when order detail is called |
orderDetailDisplayed | displayOrderDetail | Displayed on order detail on front office |
orderReturn | actionOrderReturn |
|
orderSlip | actionOrderSlipAdd | Called when a quantity of one product change in an order. |
payment | displayPayment |
|
paymentCCAdded | actionPaymentCCAdd | Payment CC added |
paymentConfirm | actionPaymentConfirmation |
|
paymentReturn | displayPaymentReturn |
|
paymentTop | displayPaymentTop | Top of payment page |
postProcessAttribute | actionAttributePostProcess | On post-process in admin feature value |
postProcessAttributeGroup | displayAttributeGroupPostProcess | On post-process in admin attribute group |
postProcessFeature | displayFeaturePostProcess | On post-process in admin feature |
postProcessFeatureValue | displayFeatureValuePostProcess | On post-process in admin feature value |
postUpdateOrderStatus | actionOrderStatusPostUpdate |
|
processCarrier | actionCarrierProcess |
|
productActions | displayProductButtons | Put new action buttons on product page |
productListAssign | actionProductListOverride | Assign product list to a category |
productOutOfStock | actionProductOutOfStock | Make action while product is out of stock |
productTab | displayProductTab | Called on order product page tabs |
productTabContent | displayProductTabContent | Called on order product page tabs |
productfooter | displayFooterProduct | Add new blocks under the product description |
rightColumn | displayRightColumn |
|
search | actionSearch |
|
shoppingCart | displayShoppingCartFooter | Display some specific informations information on the shopping cart page |
shoppingCartExtra | displayShoppingCart | Display some specific informationsinformation |
taxManager | actionTaxManager |
|
top | displayTop | A hook which allow you to do things a at the top of each pages. |
updateCarrier | actionCarrierUpdate | This hook is called when a carrier is updated |
updateOrderStatus | actionOrderStatusUpdate | Launch modules when the order's status of an order changechanges. |
updateProductAttribute | actionProductAttributeUpdate |
|
updateQuantity | actionUpdateQuantity | Quantity is updated only when the customer effectively place his order. |
updateproduct | actionProductUpdate |
|
watermark | actionWatermark |
|
Front-office and back-office
These hooks are valid for both v1.4 and 1.5 of PrestaShop.
Existing front-office hooks
Home page and general site pages
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayHeader | Called within the HTML <head> tags. Ideal location for adding JavaScript and CSS files. | N/A |
displayTop | Called in the page's header. | N/A |
displayLeftColumn | Called when loading the left column. | N/A |
displayRightColumn | Called when loading the right column. |
Note that the |
displayFooter | Called in the page's footer. | N/A |
displayHome | Called at the center of the homepage. | N/A |
Product page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayLeftColumnProduct | Called right before the "Print" link, under the picture. | N/A |
displayRightColumnProduct | Called right after the block for the "Add to Cart" button. | N/A |
displayProductButtons | Called inside the block for the "Add to Cart" button, right after that button. | N/A |
actionProductOutOfStock | Called inside the block for the "Add to Cart" button, right after the "Availability" information. | N/A |
displayFooterProduct | Called right before the tabs. | N/A |
displayProductTab | Called in tabs list, such as "More info", "Data sheet", "Accessories", etc. | N/A |
displayProductTabContent | Called when a tab is clicked. |
|
Cart page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionCartSave | Called right after a cart creation or update. | N/A |
displayShoppingCartFooter | Called right below the cart items table. | array( Can be found in |
displayShoppingCart | Called after the cart's table of items, right above the navigation buttons. | array( Can be found in |
displayCustomerAccountFormTop | Called within the client account creation form, right above the "Your personal information" block. | N/A |
displayCustomerAccountForm | Called within the client account creation form, right before the "Register" button. | N/A |
actionCustomerAccountAdd | Called right after the client account creation. | N/A |
displayCustomerAccount | Called on the client account homepage, after the list of available links. Ideal location to add a link to this list. | N/A |
displayMyAccountBlock | 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. | N/A |
displayMyAccountBlockfooter | Displays extra information inside the "My account" block. | N/A |
actionAuthentication | Called right after the client identification, only if the authentication is valid (e-mail address and password are both OK). | N/A |
actionBeforeAuthentication | Called right before authentication. | N/A |
Search page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionSearch | Called after a search is performed. Ideal location to parse and/or handle the search query and results. |
|
Carrier choice page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayBeforeCarrier | Displayed before the carrier list on front-office. | array( NOTE: intified means an array of integers 'intified' by |
displayCarrierList | Called after the list of available carriers, during the order process. Ideal location to add a carrier, as added by a module. |
|
Payment page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayPaymentTop | Top of payment page. | N/A |
displayPayment | 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. | N/A |
displayPaymentReturn | 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. |
|
displayOrderConfirmation | A duplicate of paymentReturn. |
|
displayBeforePayment | 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). |
|
Order page
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionOrderReturn | Called when the customer request to send his merchandise back to the store, and if now error occurs. |
|
displayPDFInvoice | Called when displaying the invoice in PDF format. Ideal location to display content within the invoice. | N/A |
Mobile theme hooks
All these hooks are specific to PrestaShop's default mobile theme.
The four first ones are in PrestaShop's internal hooks database, so the user can attach an action/interface to these hooks using the Modules > Positions page.
All the other ones exist in the mobile theme TPL files, but are not in the internal hooks database. A developer can still use them to attach content to specific portion of the code.
Hook name | Description |
---|---|
displayMobileTopSiteMap | |
displayMobileHeader | |
displayMobileShoppingCartTop | |
displayMobileAddToCartTop | |
displayMobileShoppingCartTop | |
displayMobileShoppingCartBottom | |
displayMobileTopSiteMap | |
displayMobileFooterChoice | |
displayMobileShoppingCartTop | |
displayMobileShoppingCartBottom | |
displayMobileIndex | |
mobileCustomerAccount | |
displayMobileTop | |
displayMobileAddToCartTop | |
displayMobileShoppingCartTop | |
displayMobileShoppingCartButton | |
displayMobileShoppingCartBottom | |
displayMobileShoppingCartTop | |
displayMobileShoppingCartBottom |
Existing back-office hooks
General hooks
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayBackOfficeTop | Called within the header, above the tabs. | N/A |
displayBackOfficeHeader | Called between the HEAD tags. Ideal location for adding JavaScript and CSS files. | N/A |
displayBackOfficeFooter | Called within the page footer, above the "Power By PrestaShop" line. | N/A |
displayBackOfficeHome | Called at the center of the homepage. | N/A |
Orders and order details
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionValidateOrder | Called during the new order creation process, right after it has been created. |
|
actionPaymentConfirmation | Called when an order's status becomes "Payment accepted". |
|
actionOrderStatusUpdate | Called when an order's status is changed, right before it is actually changed. |
|
actionOrderStatusPostUpdate | Called when an order's status is changed, right after it is actually changed. |
|
actionProductCancel | Called when an item is deleted from an order, right after the deletion. | array( |
displayInvoice | Called when the order's details are displayed, above the Client Information block. | N/A |
displayAdminOrder | Called when the order's details are displayed, below the Client Information block. | array( |
actionOrderSlipAdd | Called during the creation of a credit note, right after it has been created. |
The order of IDs and quantities is important! |
Products
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionProductSave | Called when saving products. | array( |
actionUpdateQuantity | Called during an the validation of an order, the status of which being something other than "canceled" or "Payment error", for each of the order's items. |
|
actionProductAttributeUpdate | Called when a product declination is updated, right after said update. | array( |
actionProductAttributeDelete | Called when a product declination is deleted. | array( |
actionWatermark | Called when an image is added to a product, right after said addition. |
|
displayAttributeForm | Add fields to the form "attribute value". | N/A |
displayAttributeGroupForm | Add fields to the form "attribute group". | N/A |
displayAttributeGroupPostProcess | Called when post-process in admin attribute group. | N/A |
displayFeatureForm | Add fields to the form "feature". | N/A |
displayFeaturePostProcess | Called when post-process in admin feature. | N/A |
displayFeatureValueForm | Add fields to the form "feature value". | N/A |
displayFeatureValuePostProcess | Called when post-process in admin feature value. | N/A |
Statistics
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayAdminStatsGraphEngine | Called when a stats graph is displayed. | N/A |
displayAdminStatsGridEngine | Called when the grid of stats is displayed. | N/A |
displayAdminStatsModules | Called when the list of stats modules is displayed. | N/A |
Clients
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
displayAdminCustomers | Called when a client's details are displayed, right after the list of the clients groups the current client belongs to. | N/A |
Carriers
Hook name | Description | What to expect in $params ? (Pseudocode) |
---|---|---|
actionCarrierUpdate | Called during a carrier's update, right after said update. |
|