Accueil » Conseils & tutoriels sites internet » Tutos Prestashop » Prestashop 1.7 : la liste des hooks

Prestashop 1.7 : la liste des hooks

Posté dans : Tutos Prestashop 0

Les hooks sont un élément précieux de beaucoup de CMS ou outils e-commerce (parce que sachez-le, il y a une réelle différence !), et sous Prestashop 1.7 nous pouvons en trouver pas moins de 200 natifs (bigre !).

J’avais déjà réalisé une liste des hooks Prestashop 1.6, très utilisée semble-t-il par beaucoup d’internautes au vu des visites et demandes reçues, mais avec la sortie de Prestashop 1.7, il me semblait judicieux de remettre à plat et à jour ces informations.

J’ai donc pris le temps de trier ces hooks Prestashop, afin de les agencer selon vos besoins et pour que vous soyez en mesure de trouver celui dont vous avez besoin lors du développement de vos modules ou de votre thème.

N’oubliez pas que le validateur de Prestashop dispose d’un onglet permettant de créer des modules associés à de nombreux hooks, il est utile de s’en servir. La bonne maîtrise des hooks de Prestashop fera de vous un développeur accompli, à supposer que vous connaissez bien les méthodes présentes dans cette nouvelle mouture de l’outil.

Pour ajouter des hooks à Prestashop, la Team a développé un module simple, nommé Create Hook. En cliquant ici vous retrouverez ce module d’ajout de hooks à votre Prestashop.

A vos éditeurs de code ! 

Hooks de display Prestashop 1.7

Un hook de display correspond à un affichage à un endroit ou un autre de votre site. Il est donc directement lié à votre thème. Majoritairement, le nom de ces hooks commence par “display”, terme anglophone signifiant “affichage”. Certains thèmes développés d’une manière que je me contenterai de qualifier d’étrange n’incluent pas tous les hooks de display natifs de Prestashop, ce qui peut impacter l’installation de modules. Pensez donc que si votre module ne s’affiche pas alors que celui-ci est bien certifié, peut-être est-ce parce que votre thème n’est pas totalement compatible ?

Les hooks de display front-office

displayMaintenance
Maintenance Page
This hook displays new elements on the maintenance page

displayProductPageDrawer
Product Page Drawer
This hook displays content in the right sidebar of the product page

actionPaymentConfirmation
Payment confirmation
This hook displays new elements after the payment is validated

displayPaymentReturn
Payment return

actionUpdateQuantity
Quantity update
Quantity is updated only when a customer effectively places their order

displayRightColumn
Right column blocks
This hook displays new elements in the right-hand column

displayWrapperTop
Main wrapper section (top)
This hook displays new elements in the top of the main wrapper

displayWrapperBottom
Main wrapper section (bottom)
This hook displays new elements in the bottom of the main wrapper

displayContentWrapperTop
Content wrapper section (top)
This hook displays new elements in the top of the content wrapper

displayContentWrapperBottom
Content wrapper section (bottom)
This hook displays new elements in the bottom of the content wrapper

displayLeftColumn
Left column blocks
This hook displays new elements in the left-hand column

displayHome
Homepage content
This hook displays new elements on the homepage

Header
Pages html head section
This hook adds additional elements in the head section of your pages (head section of html)

displayAfterBodyOpeningTag
Very top of pages
Use this hook for advertisement or modals you want to load first

displayBeforeBodyClosingTag
Very bottom of pages
Use this hook for your modals or any content you want to load at the very end

displayTop
Top of pages
This hook displays additional elements at the top of your pages

displayNavFullWidth
Navigation
This hook displays full width navigation menu at the top of your pages

displayRightColumnProduct
New elements on the product page (right column)
This hook displays new elements in the right-hand column of the product page

displayFooterProduct
Product footer
This hook adds new blocks under the product’s description

displayInvoice
Invoice
This hook displays new blocks on the invoice (order)

displayFooter
Footer
This hook displays new blocks in the footer

displayPDFInvoice
PDF Invoice
This hook allows you to display additional information on PDF invoices

displayInvoiceLegalFreeText
PDF Invoice – Legal Free Text
This hook allows you to modify the legal free text on PDF invoices

displayOrderConfirmation
Order confirmation page
This hook is called within an order’s confirmation page

displayCustomerAccount
Customer account displayed in Front Office
This hook displays new elements on the customer account page

displayShoppingCartFooter
Shopping cart footer
This hook displays some specific information on the shopping cart’s page

displayCreateAccountEmailFormBottom
Customer authentication form
This hook displays some information on the bottom of the email form

displayAuthenticateFormBottom
Customer authentication form
This hook displays some information on the bottom of the authentication form

displayCustomerAccountForm
Customer account creation form
This hook displays some information on the form to create a customer account

displayLeftColumnProduct
New elements on the product page (left column)
This hook displays new elements in the left-hand column of the product page

displayCarrierList
Extra carrier (module mode)

displayShoppingCart
Shopping cart – Additional button
This hook displays new action buttons within the shopping cart

displayBeforeCarrier
Before carriers list
This hook is displayed before the carrier list in Front Office

displayAfterCarrier
After carriers list
This hook is displayed after the carrier list in Front Office

displayOrderDetail
Order detail
This hook is displayed within the order’s details in Front Office

displayPaymentTop
Top of payment page
This hook is displayed at the top of the payment page

displayFeatureForm
Add fields to the form ‘feature’
This hook adds fields to the form ‘feature’

displayTopColumn
Top column blocks
This hook displays new elements in the top of columns

displayCartExtraProductActions
Extra buttons in shopping cart
This hook adds extra buttons to the product lines, in the shopping cart

displayPaymentByBinaries
Payment form generated by binaries
This hook displays form generated by binaries during the checkout

displayCarrierExtraContent
Display additional content for a carrier (e.g pickup points)
This hook calls only the module related to the carrier, in order to add options when needed

paymentOptions

paymentOptions

displayNav1

displayNav1

displayFooterBefore

displayFooterBefore

displayOrderConfirmation2

displayOrderConfirmation2

displayCrossSellingShoppingCart

displayCrossSellingShoppingCart

displaySearch

displaySearch

displayNav2

displayReassurance

displayBeforeShoppingCartBlock

displayBeforeShoppingCartBlock

displayPayment

displayPayment

displayNav
Navigation

displayCustomerLoginFormAfter
Display elements after login form
This hook displays new elements after the login form

displayProductExtraContent
Display extra content on the product page
This hook expects ProductExtraContent instances, which will be properly displayed by the template on the product page

displayAfterProductThumbs
Display extra content below product thumbs
This hook displays new elements below product images ex. additional media

displayProductAdditionalInfo
Product page additional info
This hook adds additional information on the product page

Hooks de display admin & backoffice

displayAdminOrder
Display new elements in the Back Office, tab AdminOrder
This hook launches modules when the AdminOrder tab is displayed in the Back Office

displayAdminOrderTabOrder
Display new elements in Back Office, AdminOrder, panel Order
This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Order panel tabs

displayAdminOrderTabShip
Display new elements in Back Office, AdminOrder, panel Shipping
This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Shipping panel tabs

displayAdminOrderContentOrder
Display new elements in Back Office, AdminOrder, panel Order
This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Order panel content

displayAdminOrderContentShip
Display new elements in Back Office, AdminOrder, panel Shipping
This hook launches modules when the AdminOrder tab is displayed in the Back Office and extends / override Shipping panel content

displayAdminCustomers
Display new elements in the Back Office, tab AdminCustomers
This hook launches modules when the AdminCustomers tab is displayed in the Back Office

displayAdminCustomersAddressesItemAction
Display new elements in the Back Office, tab AdminCustomers, Add
This hook launches modules when the Addresses list into the AdminCustomers tab is displayed in the Back Office

displayAdminStatsModules
Stats – Modules

displayAdminStatsGraphEngine
Graph engines

displayBackOfficeHome
Administration panel homepage
This hook is displayed on the admin panel’s homepage

displayAdminStatsGridEngine
Grid engines

displayCustomerAccountFormTop
Block above the form for create an account
This hook is displayed above the customer’s account creation form

displayBackOfficeHeader
Administration panel header
This hook is displayed in the header of the admin panel

displayBackOfficeTop
Administration panel hover the tabs
This hook is displayed on the roll hover of the tabs within the admin panel

displayBackOfficeFooter
Administration panel footer
This hook is displayed within the admin panel’s footer

displayAttributeGroupForm
Add fields to the form ‘attribute group’
This hook adds fields to the form ‘attribute group’

displayAttributeGroupPostProcess
On post-process in admin attribute group
This hook is called on post-process in admin attribute group

displayFeaturePostProcess
On post-process in admin feature
This hook is called on post-process in admin feature

displayFeatureValueForm
Add fields to the form ‘feature value’
This hook adds fields to the form ‘feature value’

displayFeatureValuePostProcess
On post-process in admin feature value
This hook is called on post-process in admin feature value

displayAttributeForm
Add fields to the form ‘attribute value’
This hook adds fields to the form ‘attribute value’

displayMyAccountBlock
My account block
This hook displays extra information within the ‘my account’ block

displayBackOfficeCategory
Display new elements in the Back Office, tab AdminCategories
This hook launches modules when the AdminCategories tab is displayed in the Back Office

displayProductListFunctionalButtons
Display new elements in the Front Office, products list
This hook launches modules when the products list is displayed in the Front Office

displayOverrideTemplate
Change the default template of current controller

displayAdminProductsMainStepLeftColumnMiddle
Display new elements in back office product page, left column of
This hook launches modules when the back office product page is displayed

displayAdminProductsMainStepLeftColumnBottom
Display new elements in back office product page, left column of
This hook launches modules when the back office product page is displayed

displayAdminProductsMainStepRightColumnBottom
Display new elements in back office product page, right column
This hook launches modules when the back office product page is displayed

displayAdminProductsQuantitiesStepBottom
Display new elements in back office product page, Quantities/Com
This hook launches modules when the back office product page is displayed

displayAdminProductsPriceStepBottom
Display new elements in back office product page, Price tab
This hook launches modules when the back office product page is displayed

displayAdminProductsOptionsStepTop
Display new elements in back office product page, Options tab
This hook launches modules when the back office product page is displayed

displayAdminProductsOptionsStepBottom
Display new elements in back office product page, Options tab
This hook launches modules when the back office product page is displayed

displayAdminProductsSeoStepBottom
Display new elements in back office product page, SEO tab
This hook launches modules when the back office product page is displayed

displayAdminProductsShippingStepBottom
Display new elements in back office product page, Shipping tab
This hook launches modules when the back office product page is displayed

displayAdminProductsCombinationBottom
Display new elements in back office product page, Combination tab
This hook launches modules when the back office product page is displayed

displayDashboardToolbarTopMenu
Display new elements in back office page with a dashboard, on top
This hook launches modules when a page with a dashboard is displayed

displayDashboardToolbarIcons
Display new elements in back office page with dashboard, on icon
This hook launches modules when the back office with dashboard is displayed

displayDashboardTop
Dashboard Top
Displays the content in the dashboard’s top area

dashboardZoneOne
dashboardZoneOne

dashboardData
dashboardData

displayAdminNavBarBeforeEnd
displayAdminNavBarBeforeEnd

displayAdminAfterHeader
displayAdminAfterHeader

displayAdminCustomersForm
displayAdminCustomersForm

dashboardZoneTwo
dashboardZoneTwo

Hooks d’action Prestashop 1.7

actionValidateOrder
New orders

actionCartSave
Cart creation and update
This hook is displayed when a product is added to the cart or if the cart’s content is modified

actionAuthentication
Successful customer authentication
This hook is displayed after a customer successfully signs in

actionProductAdd
Product creation
This hook is displayed after a product is created

actionProductUpdate
Product update
This hook is displayed after a product has been updated

actionProductDelete
Product deletion
This hook is called when a product is deleted

actionObjectProductInCartDeleteBefore
Cart product removal
This hook is called before a product is removed from a cart

actionObjectProductInCartDeleteAfter
Cart product removal
This hook is called after a product is removed from a cart

actionOrderStatusUpdate
Order status update – Event
This hook launches modules when the status of an order changes

actionCustomerAccountAdd
Successful customer account creation
This hook is called when a new customer creates an account successfully

actionCustomerAccountUpdate
Successful customer account update
This hook is called when a customer updates its account successfully

actionOrderSlipAdd
Order slip creation
This hook is called when a new credit slip is added regarding client order

actionOrderReturn
Returned product
This hook is displayed when a customer returns a product

actionWatermark
Watermark

actionProductCancel
Product cancelled
This hook is called when you cancel a product in an order

actionProductOutOfStock
Out-of-stock product
This hook displays new action buttons if a product is out of stock

actionProductAttributeUpdate
Product attribute update
This hook is displayed when a product’s attribute is updated

actionCarrierUpdate
Carrier Update
This hook is called when a carrier is updated

actionOrderStatusPostUpdate
Post update of order status

actionProductAttributeDelete
Product attribute deletion
This hook is displayed when a product’s attribute is deleted

actionCarrierProcess
Carrier process

actionPaymentCCAdd
Payment CC added

actionCategoryAdd
Category creation
This hook is displayed when a category is created

actionCategoryUpdate
Category modification
This hook is displayed when a category is modified

actionCategoryDelete
Category deletion
This hook is displayed when a category is deleted

actionHtaccessCreate
After htaccess creation
This hook is displayed after the htaccess creation

actionAdminMetaSave
After saving the configuration in AdminMeta
This hook is displayed after saving the configuration in AdminMeta

actionAttributeGroupSave
Saving an attribute group
This hook is called while saving an attributes group

actionAttributeGroupDelete
Deleting attribute group
This hook is called while deleting an attributes group

actionFeatureSave
Saving attributes’ features
This hook is called while saving an attributes features

actionFeatureDelete
Deleting attributes’ features
This hook is called while deleting an attributes features

actionProductSave
Saving products
This hook is called while saving products

actionFeatureValueDelete
Deleting attributes’ features’ values
This hook is called while deleting an attributes features value

actionFeatureValueSave
Saving an attributes features value
This hook is called while saving an attributes features value

actionAttributePostProcess
On post-process in admin feature value
This hook is called on post-process in admin feature value

actionAttributeDelete
Deleting an attributes features value
This hook is called while deleting an attributes features value

actionAttributeSave
Saving an attributes features value
This hook is called while saving an attributes features value

actionTaxManager
Tax Manager Factory

actionModuleInstallBefore
actionModuleInstallBefore

actionModuleInstallAfter
actionModuleInstallAfter

actionAdminLoginControllerSetMedia
Set media on admin login page header
This hook is called after adding media to admin login page header

actionOrderEdited
Order edited
This hook is called when an order is edited

actionEmailAddBeforeContent
Add extra content before mail content
This hook is called just before fetching mail template

actionEmailAddAfterContent
Add extra content after mail content
This hook is called just after fetching mail template

additionalCustomerFormFields
Add fields to the Customer form
This hook returns an array of FormFields to add them to the customer registration form

addWebserviceResources
Add extra webservice resource
This hook is called when webservice resources list in webservice controller

actionClearCache
Clear smarty cache
This hook is called when smarty’s cache is cleared

actionClearCompileCache
Clear smarty compile cache
This hook is called when smarty’s compile cache is cleared

actionClearSf2Cache
Clear Sf2 cache
This hook is called when the Symfony cache is cleared

actionValidateCustomerAddressForm
Customer address form validation
This hook is called when a customer submit its address form

validateCustomerFormFields
Customer registration form validation
This hook is called to a module when it has sent additional fields with additionalCustomerFormFields

actionOutputHTMLBefore
Before HTML output
This hook is used to filter the whole HTML page before it is rendered (only front)

actionUpdateLangAfter
Update lang” tables
Update lang” tables after adding or updating a language

actionDispatcherBefore
Before dispatch
This hook is called at the beginning of the dispatch method of the Dispatcher

actionDispatcherAfter
After dispatch
This hook is called at the end of the dispatch method of the Dispatcher

actionProductSearchAfter
Event triggered after search product completed
This hook is called after the product search. Parameters are already filter

actionEmailSendBefore
Before sending an email
This hook is used to filter the content or the metadata of an email before sending it or even prevent its sending

actionBuildFrontEndObject
Manage elements added to the “”prestashop”” javascript object
This hook allows you to customize the “prestashop” javascript object that is included in all front office pages

actionFrontControllerAfterInit
Perform actions after front office controller initialization
This hook is launched after the initialization of all front office controllers

sendMailAlterTemplateVars
Alter template vars on the fly
This hook is called when Mail::send() is called

actionObjectOrderAddAfter
actionObjectOrderAddAfter

actionObjectCustomerAddAfter
actionObjectCustomerAddAfter

actionObjectCustomerMessageAddAfter
actionObjectCustomerMessageAddAfter

actionObjectCustomerThreadAddAfter
actionObjectCustomerThreadAddAfter

actionObjectOrderReturnAddAfter
actionObjectOrderReturnAddAfter

actionAdminControllerSetMedia
actionAdminControllerSetMedia

actionAdminMetaControllerUpdate_optionsAfter
actionAdminMetaControllerUpdate_optionsAfter

actionAdminPerformanceControllerSaveAfter
actionAdminPerformanceControllerSaveAfter

actionObjectCarrierAddAfter
actionObjectCarrierAddAfter

actionObjectContactAddAfter
actionObjectContactAddAfter

actionAdminThemesControllerUpdate_optionsAfter
actionAdminThemesControllerUpdate_optionsAfter

actionObjectShopUpdateAfter
actionObjectShopUpdateAfter

actionAdminPreferencesControllerUpdate_optionsAfter
actionAdminPreferencesControllerUpdate_optionsAfter

actionObjectShopAddAfter
actionObjectShopAddAfter

actionObjectShopGroupAddAfter
actionObjectShopGroupAddAfter

actionObjectCartAddAfter
actionObjectCartAddAfter

actionObjectEmployeeAddAfter
actionObjectEmployeeAddAfter

actionObjectImageAddAfter
actionObjectImageAddAfter

actionObjectCartRuleAddAfter
actionObjectCartRuleAddAfter

actionAdminStoresControllerSaveAfter
actionAdminStoresControllerSaveAfter

actionAdminWebserviceControllerSaveAfter
actionAdminWebserviceControllerSaveAfter

productSearchProvider
productSearchProvider

actionAdminGroupsControllerSaveAfter
actionAdminGroupsControllerSaveAfter

actionShopDataDuplication
actionShopDataDuplication

actionObjectCategoryUpdateAfter
actionObjectCategoryUpdateAfter

actionObjectCategoryDeleteAfter
actionObjectCategoryDeleteAfter

actionObjectCategoryAddAfter
actionObjectCategoryAddAfter

actionObjectCmsUpdateAfter
actionObjectCmsUpdateAfter

actionObjectCmsDeleteAfter
actionObjectCmsDeleteAfter

actionObjectCmsAddAfter
actionObjectCmsAddAfter

actionObjectSupplierUpdateAfter
actionObjectSupplierUpdateAfter

actionObjectSupplierDeleteAfter
actionObjectSupplierDeleteAfter

actionObjectSupplierAddAfter
actionObjectSupplierAddAfter

actionObjectManufacturerUpdateAfter
actionObjectManufacturerUpdateAfter

actionObjectManufacturerDeleteAfter
actionObjectManufacturerDeleteAfter

actionObjectManufacturerAddAfter
actionObjectManufacturerAddAfter

actionObjectProductUpdateAfter
actionObjectProductUpdateAfter

actionObjectProductDeleteAfter
actionObjectProductDeleteAfter

actionObjectProductAddAfter
actionObjectProductAddAfter

actionSearch
actionSearch

actionObjectLanguageAddAfter
actionObjectLanguageAddAfter

actionAdminStoresControllerUpdate_optionsAfter
actionAdminStoresControllerUpdate_optionsAfter

actionAdminCurrenciesControllerSaveAfter
actionAdminCurrenciesControllerSaveAfter

actionModuleRegisterHookAfter
actionModuleRegisterHookAfter

actionModuleUnRegisterHookAfter
actionModuleUnRegisterHookAfter

Filtres de Prestashop 1.7 (filters)

filterCmsContent
Filter the content page
This hook is called just before fetching content page

filterCmsCategoryContent
Filter the content page category
This hook is called just before fetching content page category

filterProductContent
Filter the content page product
This hook is called just before fetching content page product

filterCategoryContent
Filter the content page category
This hook is called just before fetching content page category

filterManufacturerContent
Filter the content page manufacturer
This hook is called just before fetching content page manufacturer

filterSupplierContent
Filter the content page supplier
This hook is called just before fetching content page supplier

filterHtmlContent
Filter HTML field before rending a page
This hook is called just before fetching a page on HTML field

filterProductSearch
Filter search products result
This hook is called in order to allow to modify search product result

Voilà pour tous les hooks natifs d’un Prestashop 1.7 ! N’oubliez pas qu’un thème ou un module peut en ajouter, pensez donc à bien connaître votre site ou vos projets 😉

La liste de ces hooks peut également être trouvée dans la doc de Prestashop ici :

http://doc.prestashop.com/display/PS17/Hooks+in+PrestaShop+1.7.x

Imprimer Imprimer
Suivre Cyssoo:

Développeur - formateur

Je cherche à display errors le monde, vous auriez pas la doc' ? Follow me on Twitter !

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.