Jump to content
Corto Arnoux

En savoir plus sur les Hooks...

Recommended Posts

Bonjour,

 

Je suis développeur de modules Prestashop en interne (non destinés au shop) avec quelques semaines d'expérience.

 

J'ai acheté le très bon livre de Fabien Serny concernant le développement de modules Prestashop 1.6, la 1.7 n'étant actuellement pas ma priorité.

 

Plus les jours avancent, plus ma compréhension de Prestashop est bonne et je découvre à quel point ce core tellement critiqué par les développeurs de mon entourage est en fait proprement réalisé et plein de petites attentions pour assister les développeurs.

 

Si je viens à vous c'est parce que j'ai besoin d’éclaircissements sur un point en particulier : Les hooks. Et principalement les ActionHooks.

 

Je suis à la recherche d'une documentation, d'un tableau, ou toute autre regroupement de données concernant ces hook comme par exemple :

 

- Leurs noms

- La manière dont ils se déclenchent (Par exemple hookActionValidateOrder qui se déclenche quand une commande est passée)

- Les paramètres qui leur sont envoyés

 

Pour le moment j'ai fouillé un petit peu, le seul document pertinent que j'ai trouvé est le suivant : https://www.team-ever.com/prestashop-1-6-la-liste-des-hooks/

 

Cependant il n'est pas assez complet.

 

La seconde option serait d'étudier chacun de ces hooks, mais voilà si quelqu'un l'avait déjà fait ce serait gentil de partager l'information.

 

En vous remerciant pour votre temps.

 

Au plaisir.

 

 

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Il n'y a pas de doc, c'est ce qui fait que les devs ne l'aiment pas^^

 

Donc, allez dans la table ps_hook, vous aurez la liste (et dans ps_hook_alias la liste des équivalence rétro-actives)

 

Puis effectuez une recherche dans les contrôleurs et classes sur les noms de ces hooks pour savoir quand ils sont appelés.

  • Like 1

Share this post


Link to post
Share on other sites

Bonjour Eolia,

 

C'est bien dommage ça me semble d'une grande utilité.

 

Je vous remercie pour les pistes que vous m'avez transmises, je vais aller mener mon enquête.

 

Si je n'ai aucune information supplémentaire d'ici quelques jours je proposerai peut-être de gitter un readme participatif concernant ces Hooks.

 

En vous remerciant,

 

Bonne journée !

  • Like 2

Share this post


Link to post
Share on other sites

Bonjour, 

 

Toujours dans ma quête d'informations sur les hooks, je me suis directement adressé à Fabien Serny, ancien développeur "coeur" de Prestashop dont j'ai évoque le livre dans un précédent post.

 

Celui-ci m'a redirigé vers les liens suivants : 

 

http://www.prestarocket.com/blog/prestashop-1-7-hook-list-liste-des-hooks/

http://doc.prestashop.com/display/PS15/Hooks+in+PrestaShop+1.5

 

Ces liens répondent à la problématique, c'est pourquoi je marque le sujet résolu.

 

Son ouvrage contient un tableau des hooks avec des descriptions en Français et des informations sur les paramètres de ceux-ci, il m'a également autorisé à partager son tableau, chose que je ferais probablement sous peu.

 

En espérant que ce topic servira à d'autres apprentis développeurs Prestashop

 

Au plaisir,

 

Corto

Share this post


Link to post
Share on other sites
Le 05/10/2017 à 10:44 AM, Corto Arnoux a dit :

Son ouvrage contient un tableau des hooks avec des descriptions en Français et des informations sur les paramètres de ceux-ci, il m'a également autorisé à partager son tableau, chose que je ferais probablement sous peu.

Au vu de mes recherches récentes, ce document me serait bien utile ...

Te serait-il possible de le poster ?

Merci.

Share this post


Link to post
Share on other sites

Salut à toi,

Malheureusement j'ai prêté ce livre à un collègue actuellement je ne suis pas en mesure de le scanner.

En revanche tu trouvera une liste qui me semble contenir la liste de tous les hooks de la 1.6.

https://www.team-ever.com/prestashop-1-6-la-liste-des-hooks/

Si tu en cherche un en particulier n'hésite pas à poser ta question, j'aurais peut-être la réponse. 

Edit : Je viens de me rendre compte que j'avais déjà partagé ce lien lors du message initial du post, après réflexion il ne me semble pas que le livre en apporte énormément plus.

Edited by Corto Arnoux (see edit history)

Share this post


Link to post
Share on other sites
id_hook;name;title;description;position;live_edit
1;displayPayment;Payment;This hook displays new elements on the payment page;1;1
2;actionValidateOrder;New orders;"";1;0
3;displayMaintenance;Maintenance Page;This hook displays new elements on the maintenance page;1;0
4;actionPaymentConfirmation;Payment confirmation;This hook displays new elements after the payment is validated;1;0
5;displayPaymentReturn;Payment return;"";1;0
6;actionUpdateQuantity;Quantity update;Quantity is updated only when a customer effectively places their order;1;0
7;displayRightColumn;Right column blocks;This hook displays new elements in the right-hand column;1;1
8;displayLeftColumn;Left column blocks;This hook displays new elements in the left-hand column;1;1
9;displayHome;Homepage content;This hook displays new elements on the homepage;1;1
10;Header;Pages html head section;This hook adds additional elements in the head section of your pages (head section of html);1;0
11;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;1;0
12;actionAuthentication;Successful customer authentication;This hook is displayed after a customer successfully signs in;1;0
13;actionProductAdd;Product creation;This hook is displayed after a product is created;1;0
14;actionProductUpdate;Product update;This hook is displayed after a product has been updated;1;0
15;displayTop;Top of pages;This hook displays additional elements at the top of your pages;1;0
16;displayRightColumnProduct;New elements on the product page (right column);This hook displays new elements in the right-hand column of the product page;1;0
17;actionProductDelete;Product deletion;This hook is called when a product is deleted;1;0
18;displayFooterProduct;Product footer;This hook adds new blocks under the product's description;1;1
19;displayInvoice;Invoice;This hook displays new blocks on the invoice (order);1;0
20;actionOrderStatusUpdate;Order status update - Event;This hook launches modules when the status of an order changes.;1;0
21;displayAdminOrder;"Display new elements in the Back Office, tab AdminOrder";This hook launches modules when the AdminOrder tab is displayed in the Back Office;1;0
22;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;1;0
23;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;1;0
24;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;1;0
25;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;1;0
26;displayFooter;Footer;This hook displays new blocks in the footer;1;0
27;displayPDFInvoice;PDF Invoice;This hook allows you to display additional information on PDF invoices;1;0
28;displayInvoiceLegalFreeText;PDF Invoice - Legal Free Text;This hook allows you to modify the legal free text on PDF invoices;1;0
29;displayAdminCustomers;"Display new elements in the Back Office, tab AdminCustomers";This hook launches modules when the AdminCustomers tab is displayed in the Back Office;1;0
30;displayOrderConfirmation;Order confirmation page;This hook is called within an order's confirmation page;1;0
31;actionCustomerAccountAdd;Successful customer account creation;This hook is called when a new customer creates an account successfully;1;0
32;displayCustomerAccount;Customer account displayed in Front Office;This hook displays new elements on the customer account page;1;0
33;displayCustomerIdentityForm;Customer identity form displayed in Front Office;This hook displays new elements on the form to update a customer identity;1;0
34;actionOrderSlipAdd;Order slip creation;This hook is called when a new credit slip is added regarding client order;1;0
35;displayProductTab;Tabs on product page;This hook is called on the product page's tab;1;0
36;displayProductTabContent;Tabs content on the product page;This hook is called on the product page's tab;1;0
37;displayShoppingCartFooter;Shopping cart footer;This hook displays some specific information on the shopping cart's page;1;0
38;displayCustomerAccountForm;Customer account creation form;This hook displays some information on the form to create a customer account;1;0
39;displayAdminStatsModules;Stats - Modules;"";1;0
40;displayAdminStatsGraphEngine;Graph engines;"";1;0
41;actionOrderReturn;Returned product;This hook is displayed when a customer returns a product ;1;0
42;displayProductButtons;Product page actions;This hook adds new action buttons on the product page;1;0
43;displayBackOfficeHome;Administration panel homepage;This hook is displayed on the admin panel's homepage;1;0
44;displayAdminStatsGridEngine;Grid engines;"";1;0
45;actionWatermark;Watermark;"";1;0
46;actionProductCancel;Product cancelled;This hook is called when you cancel a product in an order;1;0
47;displayLeftColumnProduct;New elements on the product page (left column);This hook displays new elements in the left-hand column of the product page;1;0
48;actionProductOutOfStock;Out-of-stock product;This hook displays new action buttons if a product is out of stock;1;0
49;actionProductAttributeUpdate;Product attribute update;This hook is displayed when a product's attribute is updated;1;0
50;displayCarrierList;Extra carrier (module mode);"";1;0
51;displayShoppingCart;Shopping cart - Additional button;This hook displays new action buttons within the shopping cart;1;0
52;actionSearch;Search;"";1;0
53;displayBeforePayment;Redirect during the order process;This hook redirects the user to the module instead of displaying payment modules;1;0
54;actionCarrierUpdate;Carrier Update;This hook is called when a carrier is updated;1;0
55;actionOrderStatusPostUpdate;Post update of order status;"";1;0
56;displayCustomerAccountFormTop;Block above the form for create an account;This hook is displayed above the customer's account creation form;1;0
57;displayBackOfficeHeader;Administration panel header;This hook is displayed in the header of the admin panel;1;0
58;displayBackOfficeTop;Administration panel hover the tabs;This hook is displayed on the roll hover of the tabs within the admin panel;1;0
59;displayBackOfficeFooter;Administration panel footer;This hook is displayed within the admin panel's footer;1;0
60;actionProductAttributeDelete;Product attribute deletion;This hook is displayed when a product's attribute is deleted;1;0
61;actionCarrierProcess;Carrier process;"";1;0
62;actionOrderDetail;Order detail;This hook is used to set the follow-up in Smarty when an order's detail is called;1;0
63;displayBeforeCarrier;Before carriers list;This hook is displayed before the carrier list in Front Office;1;0
64;displayOrderDetail;Order detail;This hook is displayed within the order's details in Front Office;1;0
65;actionPaymentCCAdd;Payment CC added;"";1;0
66;displayProductComparison;Extra product comparison;"";1;0
67;actionCategoryAdd;Category creation;This hook is displayed when a category is created;1;0
68;actionCategoryUpdate;Category modification;This hook is displayed when a category is modified;1;0
69;actionCategoryDelete;Category deletion;This hook is displayed when a category is deleted;1;0
70;actionBeforeAuthentication;Before authentication;This hook is displayed before the customer's authentication;1;0
71;displayPaymentTop;Top of payment page;This hook is displayed at the top of the payment page;1;0
72;actionHtaccessCreate;After htaccess creation;This hook is displayed after the htaccess creation;1;0
73;actionAdminMetaSave;After saving the configuration in AdminMeta;This hook is displayed after saving the configuration in AdminMeta;1;0
74;displayAttributeGroupForm;Add fields to the form 'attribute group';This hook adds fields to the form 'attribute group';1;0
75;actionAttributeGroupSave;Saving an attribute group;This hook is called while saving an attributes group;1;0
76;actionAttributeGroupDelete;Deleting attribute group;This hook is called while deleting an attributes  group;1;0
77;displayFeatureForm;Add fields to the form 'feature';This hook adds fields to the form 'feature';1;0
78;actionFeatureSave;Saving attributes' features;This hook is called while saving an attributes features;1;0
79;actionFeatureDelete;Deleting attributes' features;This hook is called while deleting an attributes features;1;0
80;actionProductSave;Saving products;This hook is called while saving products;1;0
81;actionProductListOverride;Assign a products list to a category;This hook assigns a products list to a category;1;0
82;displayAttributeGroupPostProcess;On post-process in admin attribute group;This hook is called on post-process in admin attribute group;1;0
83;displayFeaturePostProcess;On post-process in admin feature;This hook is called on post-process in admin feature;1;0
84;displayFeatureValueForm;Add fields to the form 'feature value';This hook adds fields to the form 'feature value';1;0
85;displayFeatureValuePostProcess;On post-process in admin feature value;This hook is called on post-process in admin feature value;1;0
86;actionFeatureValueDelete;Deleting attributes' features' values;This hook is called while deleting an attributes features value;1;0
87;actionFeatureValueSave;Saving an attributes features value;This hook is called while saving an attributes features value;1;0
88;displayAttributeForm;Add fields to the form 'attribute value';This hook adds fields to the form 'attribute value';1;0
89;actionAttributePostProcess;On post-process in admin feature value;This hook is called on post-process in admin feature value;1;0
90;actionAttributeDelete;Deleting an attributes features value;This hook is called while deleting an attributes features value;1;0
91;actionAttributeSave;Saving an attributes features value;This hook is called while saving an attributes features value;1;0
92;actionTaxManager;Tax Manager Factory;"";1;0
93;displayMyAccountBlock;My account block;"This hook displays extra information within the 'my account' block""";1;0
94;actionModuleInstallBefore;actionModuleInstallBefore;"";1;0
95;actionModuleInstallAfter;actionModuleInstallAfter;"";1;0
96;displayHomeTab;Home Page Tabs;This hook displays new elements on the homepage tabs;1;1
97;displayHomeTabContent;Home Page Tabs Content;This hook displays new elements on the homepage tabs content;1;1
98;displayTopColumn;Top column blocks;This hook displays new elements in the top of columns;1;1
99;displayBackOfficeCategory;"Display new elements in the Back Office, tab AdminCategories";This hook launches modules when the AdminCategories tab is displayed in the Back Office;1;0
100;displayProductListFunctionalButtons;"Display new elements in the Front Office, products list";This hook launches modules when the products list is displayed in the Front Office;1;0
101;displayNav;Navigation;"";1;1
102;displayOverrideTemplate;Change the default template of current controller;"";1;0
103;actionAdminLoginControllerSetMedia;Set media on admin login page header;This hook is called after adding media to admin login page header;1;0
104;actionOrderEdited;Order edited;This hook is called when an order is edited.;1;0
105;actionEmailAddBeforeContent;Add extra content before mail content;This hook is called just before fetching mail template;1;0
106;actionEmailAddAfterContent;Add extra content after mail content;This hook is called just after fetching mail template;1;0
107;actionObjectProductUpdateAfter;actionObjectProductUpdateAfter;"";0;0
108;actionObjectProductDeleteAfter;actionObjectProductDeleteAfter;"";0;0
109;displayCompareExtraInformation;displayCompareExtraInformation;"";1;1
110;displaySocialSharing;displaySocialSharing;"";1;1
111;displayBanner;displayBanner;"";1;1
112;actionObjectLanguageAddAfter;actionObjectLanguageAddAfter;"";0;0
113;displayPaymentEU;displayPaymentEU;"";1;1
114;actionCartListOverride;actionCartListOverride;"";0;0
115;actionAdminMetaControllerUpdate_optionsBefore;actionAdminMetaControllerUpdate_optionsBefore;"";0;0
116;actionAdminLanguagesControllerStatusBefore;actionAdminLanguagesControllerStatusBefore;"";0;0
117;actionObjectCmsUpdateAfter;actionObjectCmsUpdateAfter;"";0;0
118;actionObjectCmsDeleteAfter;actionObjectCmsDeleteAfter;"";0;0
119;actionShopDataDuplication;actionShopDataDuplication;"";0;0
120;actionAdminStoresControllerUpdate_optionsAfter;actionAdminStoresControllerUpdate_optionsAfter;"";0;0
121;actionObjectManufacturerDeleteAfter;actionObjectManufacturerDeleteAfter;"";0;0
122;actionObjectManufacturerAddAfter;actionObjectManufacturerAddAfter;"";0;0
123;actionObjectManufacturerUpdateAfter;actionObjectManufacturerUpdateAfter;"";0;0
125;actionModuleRegisterHookAfter;actionModuleRegisterHookAfter;"";0;0
126;actionModuleUnRegisterHookAfter;actionModuleUnRegisterHookAfter;"";0;0
127;displayMyAccountBlockfooter;My account block;"Display extra informations inside the ""my account"" block";1;0
128;displayMobileTopSiteMap;displayMobileTopSiteMap;"";1;1
129;actionObjectSupplierDeleteAfter;actionObjectSupplierDeleteAfter;"";0;0
130;actionObjectSupplierAddAfter;actionObjectSupplierAddAfter;"";0;0
131;actionObjectSupplierUpdateAfter;actionObjectSupplierUpdateAfter;"";0;0
132;actionObjectCategoryUpdateAfter;actionObjectCategoryUpdateAfter;"";0;0
133;actionObjectCategoryDeleteAfter;actionObjectCategoryDeleteAfter;"";0;0
134;actionObjectCategoryAddAfter;actionObjectCategoryAddAfter;"";0;0
135;actionObjectCmsAddAfter;actionObjectCmsAddAfter;"";0;0
136;actionObjectProductAddAfter;actionObjectProductAddAfter;"";0;0
137;dashboardZoneOne;dashboardZoneOne;"";0;0
138;dashboardData;dashboardData;"";0;0
139;actionObjectOrderAddAfter;actionObjectOrderAddAfter;"";0;0
140;actionObjectCustomerAddAfter;actionObjectCustomerAddAfter;"";0;0
141;actionObjectCustomerMessageAddAfter;actionObjectCustomerMessageAddAfter;"";0;0
142;actionObjectCustomerThreadAddAfter;actionObjectCustomerThreadAddAfter;"";0;0
143;actionObjectOrderReturnAddAfter;actionObjectOrderReturnAddAfter;"";0;0
144;actionAdminControllerSetMedia;actionAdminControllerSetMedia;"";0;0
145;dashboardZoneTwo;dashboardZoneTwo;"";0;0
146;displayProductListReviews;displayProductListReviews;"";1;1
147;actionAdminMetaControllerUpdate_optionsAfter;actionAdminMetaControllerUpdate_optionsAfter;"";0;0
148;actionAdminPerformanceControllerSaveAfter;actionAdminPerformanceControllerSaveAfter;"";0;0
149;actionObjectCarrierAddAfter;actionObjectCarrierAddAfter;"";0;0
150;actionObjectContactAddAfter;actionObjectContactAddAfter;"";0;0
151;actionAdminThemesControllerUpdate_optionsAfter;actionAdminThemesControllerUpdate_optionsAfter;"";0;0
152;actionObjectShopUpdateAfter;actionObjectShopUpdateAfter;"";0;0
153;actionAdminPreferencesControllerUpdate_optionsAfter;actionAdminPreferencesControllerUpdate_optionsAfter;"";0;0
154;actionObjectShopAddAfter;actionObjectShopAddAfter;"";0;0
155;actionObjectShopGroupAddAfter;actionObjectShopGroupAddAfter;"";0;0
156;actionObjectCartAddAfter;actionObjectCartAddAfter;"";0;0
157;actionObjectEmployeeAddAfter;actionObjectEmployeeAddAfter;"";0;0
158;actionObjectImageAddAfter;actionObjectImageAddAfter;"";0;0
159;actionObjectCartRuleAddAfter;actionObjectCartRuleAddAfter;"";0;0
160;actionAdminStoresControllerSaveAfter;actionAdminStoresControllerSaveAfter;"";0;0
161;actionAdminWebserviceControllerSaveAfter;actionAdminWebserviceControllerSaveAfter;"";0;0
162;newOrder;"";"";0;0
163;cart;"";"";0;0
164;displayProductList;"";"";0;0
165;actionPSCleanerGetModulesTables;actionPSCleanerGetModulesTables;"";0;0
166;displayMobileHeader;displayMobileHeader;"";1;1
167;displayMobileShoppingCartTop;displayMobileShoppingCartTop;"";1;1
168;displayMobileAddToCartTop;displayMobileAddToCartTop;"";1;1
169;displaySearch;displaySearch;"";1;1
170;displayextraProductComparison;displayextraProductComparison;"";1;1
171;displaySlider;displaySlider;"";1;1
172;displayCartExtraProductActions;Extra buttons in shopping cart;"This hook adds extra buttons to the product lines, in the shopping cart";0;0
173;displayAdminProductsExtra;displayAdminProductsExtra;"";1;1
174;myAccountBlockfooter;myAccountBlockfooter;"";0;0
175;displayCarrierExtraContent;displayCarrierExtraContent;"";1;1
176;registerGDPRConsent;"";"";0;0
177;actionDeleteGDPRCustomer;"";"";0;0
178;displayGDPRConsent;"";"";0;0
179;actionExportGDPRData;"";"";0;0
180;actionProductCoverage;actionProductCoverage;"";0;0
181;advancedPaymentOptions;advancedPaymentOptions;"";0;0
182;displaySmartBlogLeft;displaySmartBlogLeft;This is blog page left column;1;0
183;displaySmartBlogRight;displaySmartBlogRight;This is blog page Right column;1;0
184;displaySmartBeforePost;displaySmartBeforePost;This is blog Single page before blog post;1;0
185;displaySmartAfterPost;displaySmartAfterPost;This is blog Single page after blog post;1;0
186;actionsbnewpost;actionsbnewpost;this is action hook.;1;0
187;actionsbupdatepost;actionsbupdatepost;this is action hook.;1;0
188;actionsbdeletepost;actionsbdeletepost;this is action hook.;1;0
189;actionsbtogglepost;actionsbtogglepost;this is action hook.;1;0
190;actionsbnewcat;actionsbnewcat;this is action hook.;1;0
191;actionsbupdatecat;actionsbupdatecat;this is action hook.;1;0
192;actionsbdeletecat;actionsbdeletecat;this is action hook.;1;0
193;actionsbtogglecat;actionsbtogglecat;this is action hook.;1;0
194;actionsbpostcomment;actionsbpostcomment;this is action hook.;1;0
195;actionsbappcomment;actionsbappcomment;this is action hook.;1;0
196;actionsbsingle;actionsbsingle;this is action hook.;1;0
197;actionsbcat;actionsbcat;this is action hook.;1;0
198;actionsbsearch;actionsbsearch;this is action hook.;1;0
199;actionsbheader;actionsbheader;this is action hook.;1;0
200;moduleRoutes;moduleRoutes;"";0;0

Share this post


Link to post
Share on other sites

Merci à vous tous  🙂

Mais je me suis mal exprimé : je cherche plutôt à faire la distinction entre les Hooks dédiés au back-office et ceux du front-office

J'avais trouvé une liste classée mais pour Presta 1.5 ...

@Eolia : c'est gentil à toi, mais je sais déjà chercher dans la DB, dois-je te rappeler que je suis un vieux codeur ?  😛

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More