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?

 

 

Link to comment
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 

from

class CustomerAddressFormatterCore implements FormFormatterInterface
{

    
}

to

class CustomerAddressFormatter extends CustomerAddressFormatterCore
{

 


}

dont forget to clear cache from backoffice

 

 

Link to comment
Share on other sites

  • 7 months later...

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...