"Three Rock has consulted for me in three organisations to date and has worked on many varied projects. I have found Peter Mac and his team's expertise and honesty to be refreshing in this industry."

Peter Laws, ex CIO William Angliss TAFE College and IT Manager Department of Human Services

Today's Tech News

Warning: Creating default object from empty value in /var/www/threerock/modules/mod_newsticker/helper.php on line 50
Microsoft Inks UC Deal With Polycom
Under a multi-year agreement unveiled Monday, Polycom will begin shipping...
IT Earnings Way Up at Job Site Elance
Google App Engine, HTML5, search engine optimization and social media...
Google, Verizon Posit Net Neutrality Accord
The two Internet and communications giants have put aside their...
Tech Stocks Gain Despite HP's Plunge
HP investors had a bad day, but the rest of...
New Federal Data Breach Bill Debuts in Senate
The new bill is getting early support from prominent Democrats...
Virtuemart States for Australia

Modifying an out of the box installation of Virtuemart for the Australian market where addresses have a two and three character state code ie QLD, NSW, TAS, WA, SA, NT etc.

This is a fairly simple fix and works a treat for Virtuemart 1.14

Three simple changes require. One change each for the following two file

components/com_virtuemart/themes/default/templates/checkout/list_shipto_addresses.tpl.php

components/com_virtuemart/themes/default/templates/checkout/customer_info.tpl.php

In each file search for the first occurrance of the word 'state'.

You will find the default is using state_2_code

In each file, change it to state_3_code

The next file to update is

administrator/components/com_virtuemart/classes/ps_html.php

Again, all occurrances of state_2_code need to be changed to state_3_code 

Another little fix I used is where no City value is entered, an ugly looking comma is displayed. To stop this, come a few lines above the state change you've just made. Find the line that has the text

echo $db->f("city");

Underneath it you'll find the culprit, a line that just blindly outputs a comma

echo ', ';

Just above the comma culprit place the following 'if' condition.

if($db->f("city") != "")

so your code should look like this:

if($db->f("city") != "")
echo ', ';

 The address section of the file now looks something like the following

<td nowrap="nowrap" width="10%" align="right"><?php echo $VM_LANG->_('PHPSHOP_ADDRESS') ?>: </td>
           <td width="90%">
           <?php
             $db->p("address_1");
            if($db->f("address_2") != ""){
                 echo "<br />";
                 $db->p("address_2");
        }
           ?>
           </td>
        </tr>
        <tr>
           <td nowrap="nowrap" width="10%" align="right"> </td>
           <td width="90%">
           <?php

            if($db->f("city")!=""){
                echo  $db->f("city");
                echo "<br />";
            }
             // for state, can be used: state_name, state_2_code, state_3_code
             if($db->f("state_3_code") != ""){
                $db->p("state_3_code");
                echo " ";
                $db->p("zip");
                echo "<br />";
         }
             // for country, can be used: country_name, country_2_code, country_3_code
             $db->p("country_name");
           ?>
           </td>
Now you've updated the code, your 3 letter states will be listed with three letters.

But hang on!! What about NT, SA and WA?

Unfortunately they get changed to NOT SOA and WEA. Not what we want.

To fix this, log into your Virtuemart site as an administrator.

Select the 'Admin' menu option, then List Countries.

Click the '[List States]' suboption against the country name.

n here you can enter the correct values for the 3 character value for each state.