Jump to content

Admin customer view, add column to addresses grid


Recommended Posts

Hi everyone, through a module I created I added two new fields to the Address class (fields added to the DB and to the Address class via an override of the module).
I would need to display these two new fields in the Addresses grid located in the backoffice in the customer view.

image.thumb.png.ecfeecb428113e0b422b91a698e0fed6.png

Can anyone tell me a hook to use or give me some suggestions?
Let me start by saying that I was able to add other custom fields in the customer list (using hookActionCustomerGridDefinitionModifier  and hookActionCustomerGridQueryBuilderModifier) but here it seems to me that the approach is different

image.thumb.png.9cc8fcc0c856798732716895e5256e48.png

thank you

Link to comment
Share on other sites

Hello!

To display the two new fields in the Addresses grid in the backoffice customer view in PrestaShop, you will need to override specific hooks and modify the templates. Here's a general approach to achieve this:

1. Override the Address Class:

Ensure you have already added the new fields to the Address class and database as you've mentioned.

2. Modify the Address Grid:

You will need to use hooks related to the address grid. Specifically, you can use hookActionAdminAddressesListingFieldsModifier and hookActionAdminAddressesFormModifier.

3. Update the Template:

Modify the backoffice template to include the new fields.

 

If you need further customization or run into specific issues, let me know and we can try to work through the process step by step.

 

Link to comment
Share on other sites

Thank you Luisejo for your suggestions.

I modified my module to register and implement the hookActionAdminAddressesListingFieldsModifier hook

image.png.74b6b6193ac98086cde10dc189afe464.png

image.png.c54fd695d9a1c43b6a62199c0c174e97.png

After reinstalling the module I see it correctly hooked in positions

image.thumb.png.6bb10ca7269397f8a2d438652712b8f3.png

However I see that the hook is not called either in the general address list or in the one within the customer card

image.thumb.png.d8cd6ae896dd0f57b943e8147c63cf79.png

image.thumb.png.a2ebbcf134ddaed73cc561ce7d74a894.png

 

  • Like 1
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...