Jump to content

Extend/override CustomerAddressFormatter

Recommended Posts

I want to change the behaviour for a store, in order to display a list of cities for the customer address (instead of an input text).

Cities are stored in a custom table.


Looks like prestashop 1.7.x is using Formatters class to produce a form.


I need then to override the getFormat() method of CustomerAddressFormatterCore in order to fill the city list as a select and with a custom list.


I tried to put the /form/classname class in overrides but doesn't seem to work.


any idea on how to achieve this?



Share this post

Link to post
Share on other sites

copy  the CustomerAddressFormatter from classes/form/CustomerAddressFormatter.php  and paste this file into override/classes/form/

open with text editor the filename CustomerAddressFormatter.php from override folder and near line 30  change 


class CustomerAddressFormatterCore implements FormFormatterInterface



class CustomerAddressFormatter extends CustomerAddressFormatterCore



dont forget to clear cache from backoffice



Share this post

Link to post
Share on other sites


I have a issue with override

The change has been changed, you can see it on the front end (I added next to "Mobile Phone" (for the carrier)).
However, it cannot be found in the Back Office to translate it into other languages.
 Maybe there's a problem with visibility (public/private)

Thanks for your help




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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