Post by OpenCustomer » Sun Oct 16, 2016 6:36 pm

I need to change the US States from long names to abbreviated form in checkout drop-down list such as from Alabama to AL. I want that change would be also written in the orders, order confirmation, etc. in customer`s addresses.

I tried to change this in oc_zone but didn't help. It only changed in the admin zones page.

How do I do this? Is there a main place to be able to make that change?

Thanks,
sa

User avatar
New member

Posts

Joined
Mon Oct 26, 2015 2:43 am

Post by fido-x » Sun Oct 16, 2016 7:18 pm

Have a look in the following files:
  • catalog/view/theme/default/template/checkout/payment_address.tpl
    catalog/view/theme/default/template/checkout/shipping_address.tpl
    catalog/view/theme/default/template/checkout/guest.tpl
    catalog/view/theme/default/template/checkout/guest_shipping.tpl
Find:

Code: Select all

html += '>' + json['zone'][i]['name'] + '</option>';
and change to:

Code: Select all

html += '>' + json['zone'][i]['iso_code_2'] + '</option>';

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by OpenCustomer » Sun Oct 16, 2016 10:41 pm

I am on Journal theme. I edited the both default and Journal theme files as you suggested but didn't help. I still read the long form of the US States in the drop-down in checkout page.

Any more advice please?

User avatar
New member

Posts

Joined
Mon Oct 26, 2015 2:43 am

Post by fido-x » Mon Oct 17, 2016 10:35 am

Sorry, my bad. I was looking at the country code and not the zone code. Use the following code in the aforementioned files:

Code: Select all

html += '>' + json['zone'][i]['code'] + '</option>';
That should cover the orders.

For customer account information, you'll also need to make the same change to:
  • catalog/view/theme/default/template/account/address_form.tpl
    catalog/view/theme/default/template/account/register.tpl

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by OpenCustomer » Mon Oct 17, 2016 11:57 pm

No Sir, didn't change. Still reading long form of States.

User avatar
New member

Posts

Joined
Mon Oct 26, 2015 2:43 am

Post by fido-x » Tue Oct 18, 2016 6:48 am

Refresh your modifications.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by rexa » Tue Dec 06, 2016 10:06 am

I'm having the same issue here, and I know this has been an ongoing thing with US opencart users. I implemented the modifications as suggested on this thread, but all they do is change the state abbreviations in the options selector, but does not save as such to the actual addressbook entry.

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am

Post by rexa » Thu Dec 08, 2016 2:58 pm

Nevermind. I created my own VQmod to reduce the zone_id character limitations and I renamed the zone_ids for the states as abbreviations instead of leaving them as long names.

The problem I found with the previous coding suggesting is that it only shows them as drop-down menu options but not effectively saving them as such abbreviations - just an fyi

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am
Who is online

Users browsing this forum: No registered users and 56 guests