Jump to content

Hook inside Prestashop default module


The50

Recommended Posts

Hello,

 

I want to add my function onto the hook which is in my-account.tpl file. There is a hook named displayCustomerAccount. Now I need to add my function which adds extra fields inside that page. How can I attach it to the hook displayCustomerAccount? My function is in a module I created, but how can I attach my module onto that hook without editing displayCustomerAccount file? It's core file so I don't want to loose the ability to update my Prestashop.

Link to comment
Share on other sites

Morn' the50,

 

First of all : Your method (Function) in your module is correctly named, like : hookDisplayCustomerAccount

Second : Make sure your module is installed (Sounds stupid, but my god did I search for that problem last week like...a moron)

Third : On method install(), did you register on the hook?

Fourth : If you didn't, you can go into "modules->Position" and hook your module on its hook.

 

Also, since you want to add fields to DisplayCustomerAccount, I bet you want to save these fields somewhere after too? There's a hook called "actionObject{CLASS}AddBefore" and "actionObject{CLASS}AddAfter" (For you it will be : actionObjectCustomerAddAfter) that you can use. This hook should be used to save your data after the Customer creation. BE CAUTIOUS THO : This hook is also called when you create in the backoffice, so you should check if your additionnals fields are set (if(Tools::getIsset("your_field")) ). WOOPS : My mistake, it's not on customer creation you are hooking, my bad.

 

Best of luck young Jedi.

 

Martin.

Edited by Martin Uker K (see edit history)
  • Like 2
Link to comment
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...