Jump to content

USA address format - State ISO


Recommended Posts

I'm a UK based shop but a good proportion of my orders are from USA.    I drag & drop the address details into the Royal Mail Click & Drop online portal to process my postage. 

The Cubecart address format has the US customers declare their state in long-hand version rather than the shortened ISO format eg South Dakota instead of SD.   I have to manually amend these on the Royal Mail portal & occasionally have to double check against a list for some states ISO code that I use infrequently.

Is there a way the ISO code for US States could be used on Cubecart instead of long-hand version?

Link to comment
Share on other sites

You are getting the address items from the admin, Order Summary page?

If so, try the following:

In the admin /sources/orders.index.inc.php:

Near line 419, find:

$overview_summary['country'] = is_numeric($overview_summary['country']) ? getCountryFormat($overview_summary['country'], 'numcode', 'name') : $overview_summary['country'];

After that, add:
$overview_summary['state_abbrev_d'] = is_numeric($overview_summary['state_d']) ? getStateFormat($overview_summary['state_d'], 'id', 'abbrev') : $overview_summary['state_d'];
$overview_summary['state_abbrev']  = is_numeric($overview_summary['state']) ? getStateFormat($overview_summary['state'], 'id', 'abbrev') : $overview_summary['state'];

In the admin template orders.index.php:

Near lines 163-164, from:

{$OVERVIEW_SUMMARY.town_d|upper}<br>
{if !empty($OVERVIEW_SUMMARY.state_d)}{$OVERVIEW_SUMMARY.state_d|upper}, {/if}{$OVERVIEW_SUMMARY.postcode_d}<br>

To:

{$OVERVIEW_SUMMARY.town_d|upper}&nbsp;
{if !empty($OVERVIEW_SUMMARY.state_abbrev_d)}{$OVERVIEW_SUMMARY.state_abbrev_d|upper}, {/if}{$OVERVIEW_SUMMARY.postcode_d}<br>

Near lines 174-175, from:

{$OVERVIEW_SUMMARY.town|upper}<br>
{if !empty($OVERVIEW_SUMMARY.state)}{$OVERVIEW_SUMMARY.state|upper}, {/if}{$OVERVIEW_SUMMARY.postcode}<br>

To:
{$OVERVIEW_SUMMARY.town|upper}&nbsp;
{if !empty($OVERVIEW_SUMMARY.state_abbrev)}{$OVERVIEW_SUMMARY.state_abbrev|upper}, {/if}{$OVERVIEW_SUMMARY.postcode}<br>

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...