Switch Postal Code and City (and State)

  • Posts: 189
  • Thank you received: 11
  • Hikashop Business
5 years 1 month ago #311824

-- HikaShop version -- : 4.2.1
-- Joomla version -- : 3.9.12
-- PHP version -- : 7.3
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : none

Is it possible to switch the Postal Code and City per country on the order notifications and on the profile pages? E.g. Canada uses "City, State, Postal Code" and The Netherlands uses "Postal Code, City" but not often "State". Thanks for suggestions!

Last edit: 5 years 1 month ago by Rixters.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 1 month ago #311829

Hi,

There is no option to do that.
However, it's possible. In the "address format" setting of the HikaShop configuration, you can enter PHP code.
So you can check the country of the address in order to display the custom field tags in a different order.
Something like that:

<?php $address_id = hikashop_getCID('address_id');
$class = hikashop_get('class.address');
$address = $class->get($address_id);
if($address->address_country == 'XXX') {
 echo '{address_post_code}{address_city}';
} else {
 echo '{address_city}{address_state}{address_post_code}';
}
?>
where XXX is the zone namekey of the country in the hikashop_zone table.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum