Australian zone and tax settings

You can plug all the default zone and tax settings through the Admin but there’s an easier way. The sql snippets below can be run through phpMyAdmin which you can usually access through cPanel. Once in phpmyadmin, select the database you want to update and click on the Sql tab at the top of the page. Copy n paste the code below then Go. Once done, your Australian store will have all the tax and zone information needed for using various shipping and payment modules.

Note – the sqls below are for a store that is missing the data. Check your admin for these settings already (eg under Localizations >> Currencies for AUD; under Locations/Taxes >> Zones for Australian states. There’s no point readding them if they already exist.)

Australian Zones (States)

INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'NSW','New South Wales');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'VIC','Victoria');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'QLD','Queensland');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'NT','Northern Territory');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'WA','Western Australia');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'SA','South Australia');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'TAS','Tasmania');
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES ('',13,'ACT','Australian Capital Territory');

Australia GST Setup

update tax_class set tax_class_title="GST" where tax_class_title = "Taxable Goods";
update tax_class set tax_class_description="The following types of products attract GST in Australia" where tax_class_title = "GST";
update tax_rates set tax_description = "GST" where tax_description = "FL TAX 7.0%";
update tax_rates set tax_rate = "10" where tax_description = "GST";

Australia Currency Setup

update currencies set code = "AUD" where code = "USD";
update currencies set title = "Australian Dollar" where code = "AUD";
update configuration set configuration_value = "AUD" where configuration_key = "DEFAULT_CURRENCY";
update configuration set configuration_value = "true" where configuration_key = "DISPLAY_PRICE_WITH_TAX";

Australia Tax Geo Zone Setup

insert into `geo_zones` (`geo_zone_id`,`geo_zone_name`,`geo_zone_description`) values (1,'Australia','');
insert into zones_to_geo_zones (zone_country_id, zone_id, geo_zone_id)
select countries_id as zone_country_id, 0 as zone_id, geo_zone_id
   from countries, geo_zones
   where countries_name = "Australia"
   and geo_zone_name = "Australia";

change number of records shown in admin

Problem: the number of orders displayed by default is a mere 20. You have to use a dropdown to see results 21-40.

Go to Admin > Configuration > Maximum Values and change the Search Results figure to something more useful, as shown in the screen below:

screenshot of cre loaded admin, configuration, max values, search results

The Search Results setting controls the number of results displayed on each page in several different areas of the Admin, including Countries listed, Customer accounts shown, products on Specials … handy to know about this well-hidden setting!

speed up your site – set expiration in cache control

Another useful Apache utility called mod_headers can be used to set an expiration date in the future of files like images and static html pages. This means that rather than loading image files or unchanging html code every time you visit a site, a check will be made in the cache of your browser to see if there is already an existing copy of the file requested. If the file is still ‘fresh’ – ie within the period specified by the expiration, the cached version of the file will be used and no ‘refresh’ call will be made to the host server.

Your server needs to have mod_headers enabled before being able to use these directives. You can add this code to your root htaccess file, or http.conf / vhosts.conf if you have access to those.

#cache html and htm files for one day   
Header set Cache-Control "max-age=43200"  
#cache css, javascript and text files for one week   
Header set Cache-Control "max-age=604800"  
#cache flash and images for one month   
Header set Cache-Control "max-age=2592000"  
#disable cache for script files   
Header unset Cache-Control   

When changing conf files on an Apache server, remember to Apply Changes and restart the Apache server for the directives to take effect.

Another approach is to use ExpiresByType commands in the htaccess file:

# turn on the module for this directory
    ExpiresActive on
# set default
    ExpiresDefault "access plus 24 hours"
    ExpiresByType image/jpg "access plus 1 months"
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    ExpiresByType image/x-icon "access plus 1 months"
    ExpiresByType text/css "access plus 1 months"
    ExpiresByType text/javascript "access plus 1 months"
    ExpiresByType application/javascript "access plus 1 months"
    ExpiresByType application/x-shockwave-flash "access plus 1 months"

Final tip: set eTags to null using:

Header unset ETag
FileETag None

speed up your site – use compression

If your server is running Apache 2.xx then mod_deflate can be used to compress certain file types, which will give a real boost in loading speed as the client’s browser will be uncompressing the content, rather than the server carrying the full load.

To enable mod_deflate, add the following to root htaccess (or ideally http.conf or if on a virtual server, vhosts.conf)

SetOutputFilter DEFLATE

This snippet of code compresses javascript and css for unpacking by the visitor’s browser.

If your server is running Apache 1.x then mod_gzip can be used. This can be added to the root htaccess file.

    mod_gzip_on         Yes   
    mod_gzip_dechunk    Yes   
    mod_gzip_item_include file          .(html?|txt|css|js|php|pl)$   
    mod_gzip_item_include handler       ^cgi-script$   
    mod_gzip_item_include mime      ^text.*   
    mod_gzip_item_include mime      ^application/x-javascript.*   
    mod_gzip_item_exclude mime      ^image.*   
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*   

You might also like to enable Gzip Compression through Admin/Configuration/Gzip Compression, set at 9.

better rounding of prices including tax

The rounding function produces rounding errors of 1c in some cases – sure, no big deal, but why not get it right eh?

So after checking osCommerce I found a better rounding formula that might work for you too (esp on taxable products):

File : includes/functions/general.php

// Wrapper function for round()
  function tep_round($number, $precision) {
    if (strpos($number, '.') && (strlen(substr($number, strpos($number, '.')+1)) > $precision)) {
      $number = substr($number, 0, strpos($number, '.') + 1 + $precision + 1);

      if (substr($number, -1) >= 5) {
        if ($precision > 1) {
          $number = substr($number, 0, -1) + ('0.' . str_repeat(0, $precision-1) . '1');
        } elseif ($precision == 1) {
          $number = substr($number, 0, -1) + 0.1;
        } else {
          $number = substr($number, 0, -1) + 1;
      } else {
        $number = substr($number, 0, -1);

    return $number;

Replace with:

function tep_round($number, $round=2) {
   $tempd = $number*pow(10,$round);
   $tempd1 = round($tempd);
   $number = $tempd1/pow(10,$round);
   return $number;

ideas and help with oscommerce-based shopping carts