Author Topic: Abbreviations for Australian States  (Read 17811 times)

aussiemike

  • Jr. Member
  • **
  • Posts: 61
    • Pocket Money Marketing
Abbreviations for Australian States
« on: August 29, 2008, 12:49:18 pm »
The abbreviations for Australian are incorrect (State Code (2)). How do I change this as it is not possible from admin. Will changing them cause any other problems with VM or payment modules?

For future releases they should be as follows:
Australian Capital Territory - ACT
New South Wales - NSW
Northern Territory - NT (this is correct)
Queensland - QLD
South Australia -SA (this is correct)
Tasmania - TAS
Victoria - VIC
Western Australia - WA (this is correct)

vjtemplates

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 262
    • VJ Templates
Re: Abbreviations for Australian States
« Reply #1 on: August 30, 2008, 03:31:16 am »
Yes, you can change it from admin. Go to Admin -- List Countries. Then click "List State" for Australia. Next, click to whatever state you want to change.
VirtueMart Templates

http://www.vjtemplates.com

aussiemike

  • Jr. Member
  • **
  • Posts: 61
    • Pocket Money Marketing
Re: Abbreviations for Australian States
« Reply #2 on: August 30, 2008, 03:41:36 am »
Yes this works for State Code(1) but not for State Code(2)

pen999

  • Beginner
  • *
  • Posts: 4
Re: Abbreviations for Australian States
« Reply #3 on: August 30, 2008, 13:58:39 pm »
hey aussiemike
I had the same problem.
the last post http://forum.virtuemart.net/index.php?topic=16887 here has worked so far for me (database via phpmyadmin and change the char.)
Pen

aussiemike

  • Jr. Member
  • **
  • Posts: 61
    • Pocket Money Marketing
Re: Abbreviations for Australian States
« Reply #4 on: August 30, 2008, 14:09:21 pm »
Thanks Pen
Much appreciated. I'll have to bookmark your hack for the future.

Partic

  • Jr. Member
  • **
  • Posts: 53
    • KPS
Re: Abbreviations for Australian States
« Reply #5 on: January 03, 2009, 23:54:32 pm »
This problem actually should be fixed up in the VM core to avoid having to hack it each time. In 1.1.2 I can't find the trigger to use the 3 character values in the VM COnfig - is the hack for VM 1.0 actually implemented in VM 1.1?

Also, the default data has 3 of the Australian State abbreviations wrong for the 3 character versions... not all the Aussie States are reduced to 3, some are two.

In particular:
- Northern Territory should be NT
- South Australia should be SA
- Western Australia should be WA

But to fix all of the states quickly for Australian Users:
- Copy the code below
- Log into your PHPMyAdmin
- Run the following SQL statement (assumes your table prefix is jos_ and state table records match default install values)
- You should find the values all corrected.

Code: [Select]
# SQL To fix Australian State Abbreviations in Virtuemart
# Posted 4 Jan 2008 to the VM forum

# Change Table Structure for State Character State Code from 2 to 3 characters
ALTER TABLE `jos_vm_state` CHANGE `state_2_code` `state_2_code` VARCHAR(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

# Update values for Australian State abbreviations
UPDATE `jos_vm_state` SET `state_3_code` = 'ACT',`state_2_code` = 'ACT' WHERE `jos_vm_state`.`state_id` =69 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'NSW',`state_2_code` = 'NSW' WHERE `jos_vm_state`.`state_id` =70 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'NT',`state_2_code` = 'NT' WHERE `jos_vm_state`.`state_id` =71 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'QLD',`state_2_code` = 'QLD' WHERE `jos_vm_state`.`state_id` =72 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'SA',`state_2_code` = 'SA' WHERE `jos_vm_state`.`state_id` =73 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'TAS',`state_2_code` = 'TAS' WHERE `jos_vm_state`.`state_id` =74 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'VIC',`state_2_code` = 'VIC' WHERE `jos_vm_state`.`state_id` =75 LIMIT 1 ;
UPDATE `jos_vm_state` SET `state_3_code` = 'WA',`state_2_code` = 'WA' WHERE `jos_vm_state`.`state_id` =76 LIMIT 1 ;

# Display corrected values
SELECT * FROM `jos_vm_state` WHERE `country_id` =13;

ufo_hk

  • Jr. Member
  • **
  • Posts: 79
    • 4success Ltd
Re: Abbreviations for Australian States
« Reply #6 on: January 21, 2009, 23:22:58 pm »
Thanks Partic for the quick fix.

Hopefully we can see 3 character values (or selection of 2/3 codes) in the core soon.

Kai920

  • Beginner
  • *
  • Posts: 34
Re: Abbreviations for Australian States
« Reply #7 on: December 07, 2009, 07:41:13 am »
Partic: many thanks for your hack. Worked like a charm for VM 1.1.4.

Attached is result:

[attachment cleanup by admin]