"We needed technical guidance and support and thanks to the team at Three Rock we now have streamlined processes and can manage the project with ease."

Steve Sherlock: Managing Director 'Oodles' car hire comparison web site

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



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


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%">
            if($db->f("address_2") != ""){
                 echo "<br />";
           <td nowrap="nowrap" width="10%" align="right"> </td>
           <td width="90%">

                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") != ""){
                echo " ";
                echo "<br />";
             // for country, can be used: country_name, country_2_code, country_3_code
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.