tastyigniter / TastyIgniter

:fire: Powerful, yet easy to use, open-source online ordering, table reservation and management system for restaurants
https://tastyigniter.com
MIT License
2.98k stars 966 forks source link

[Bug]: Address format is always the default format ignoring Localization > Countries > United States > Format #1047

Closed mariodees closed 9 months ago

mariodees commented 1 year ago

What happened?

Addresses formatted using Countries_model::addressFormat() always use default format : {address_1}\n{address_2}\n{city} {postcode}\n{state}\n{country}

Because of:

app/system/libraries/Country.php

Countries_model::addressFormat()

$format = $this->getDefaultFormat();
$address = $this->evalAddress($address);
if (!empty($address['format']))
    $format = $address['format'];

Countries_model::evalAddress() will strip the format value by rebuilding the address based on the Countries_model::$requiredAddressKeys array which does not include 'format', so $format will always be equal to Countries_model::getDefaultFormat()

Could 'format' be safely added to Countries_model::$requiredAddressKeys[] without breaking things elsewhere?

What did you expect to happen?

Address to be formatted with the custom value entered in Localization > Countries > United States > Format

{address_1}\n{city}, {state} {postcode}\n{country}

Version

3.x

What browser are you seeing the problem on?

No response

Relevant log output

No response

sampoyigi commented 12 months ago

Yea, should be safe to add the format key

sampoyigi commented 10 months ago

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider the Dedicated Support Service where a Service Level Agreement is offered.