Hi,
In admin Customer Data, I can install new modules Company & Department, so that they are available for customers to fill in for registration. Company & Department also become part of customer address, for example:
Company
Department
My Name
My Street Address
My City, State Postpostcode
My Country
My questions are: Is there a way to change the format, such as listing Company & Department under My Name? Then this leads to my 2nd question: where in the core code parses the address format defined in the 'address_format' table? Maybe the code is where I can format the address the way I want?
Thanks in advance for any help.
Eddy
Customer Data v.s. Address Format
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Customer Data v.s. Address Format
cd_traditional_address.php
If you need to add a new field (e.g. department), you could duplicate it as cd_moxamint_address.php and make edits to that. Uninstall the core module and install yours instead.
If you just need to reorder the fields, change them in the address_format table. E.g.
Code: Select all
INSERT INTO address_format VALUES (1, '$name$cr$company$cr$streets$cr$city, $postcode$cr$statecomma$country', '$city / $country');
INSERT INTO address_format VALUES (2, '$name$cr$company$cr$streets$cr$city, $state $postcode$cr$country', '$city, $state / $country');
INSERT INTO address_format VALUES (3, '$name$cr$company$cr$streets$cr$city$cr$postcode - $statecomma$country', '$state / $country');
INSERT INTO address_format VALUES (4, '$name$cr$company$cr$streets$cr$city ($postcode)$cr$country', '$postcode / $country');
INSERT INTO address_format VALUES (5, '$name$cr$company$cr$streets$cr$postcode $city$cr$country', '$city / $country');Code: Select all
INSERT INTO address_format VALUES (1, '$name$cr$company$cr$department$cr$streets$cr$city, $postcode$cr$statecomma$country', '$city / $country');
INSERT INTO address_format VALUES (2, '$name$cr$company$cr$department$cr$streets$cr$city, $state $postcode$cr$country', '$city, $state / $country');
INSERT INTO address_format VALUES (3, '$name$cr$company$cr$department$cr$streets$cr$city$cr$postcode - $statecomma$country', '$state / $country');
INSERT INTO address_format VALUES (4, '$name$cr$company$cr$department$cr$streets$cr$city ($postcode)$cr$country', '$postcode / $country');
INSERT INTO address_format VALUES (5, '$name$cr$company$cr$department$cr$streets$cr$postcode $city$cr$country', '$city / $country');Code: Select all
$department = $address['department'] ?? '';There might be some clever replacement for lines 91-7 and 109, like
Code: Select all
extract($address, EXTR_PREFIX_SAME | EXTR_REFS, 'address');