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
  • 1 year later...

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
  • 7 months later...


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

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