Hello all,

I have ported the uc_auspost module to drupal 6/ubercart 2. The base code is the original ubercart 1 uc_auspost module which can be found here http://www.ubercart.org/comment/10283/Re_Hi_Again_Herere_few_error.

I used the ubercart 2 uc_ups and uc_usps modules as a guide. there are quite a few changes to the original uc_auspost code. For those interested, here are some of the changes/details.

* There are now two conditional actions to see if the destination country is Australia or "not Australia". If so, a domestic function is called, if not an international function is called. It is much the same as how uc_usps does it.

* Because of the two conditional actions, there are now two Shipping methods, Australia Post and Australia Post (Intl.). So enable them both if you want to ship everywhere in the world.

* In the Shipping quote settings for auspost the domestic and international services are now split into two groups.

* I removed the option to package similar items together. I went with what ups and usps have and that is "Each in its own package" and "All in one".

* One thing that is important to note is that even if you have "All in one" selected and a customer orders only one product but with a quantity more than 1, the number of identical products in the package will depond on the "Package quantity" setting for that product. e.g. if this is set to one, then one package will be created for every item and will not put them "All in one" package. So it is important to set the "Package quantity" for each product. This is the way the ups and usps modules seem to do it.

* I took out some of the custom length and weight conversion functions and am using uc_weight_conversion() and uc_length_conversion().

* When "Each in its own package" is selected, the dimensions of the product are sent to the online delivery calculator. When things are packaged "All in one" I used the same dummy dimensions (250mm x 250mm x 250mm). Maybe this is something that can be worked on in the future.


1. Upload the module to your ubercart/contrib directory and enable it on your Drupal site.
2. Enable shipping method at admin/store/settings/quotes/methods
3. Configure the auspost settings at admin/store/settings/quotes/methods/auspost

I have tested the module and it seems to behave itself but it needs some more testing from the community.

uc_auspost-6.x-1.x-dev.tar.gz26.86 KB
sammys's picture
Bug FinderGetting busy with the Ubercode.
Joined: 03/19/2009
Juice: 29
Thanks for the port

Hi there dave,

Thank you for porting the module to 2.x. It's looking pretty sweet!

Are there any plans to support registered post/insurance added onto the regular post option?


Sammy Spets

mballinger's picture
Joined: 04/22/2009
Juice: 2
Thankyou for a great Contribution

Much appreciated, looking forward to implementing it in the near future.

peter.hennessy's picture
Joined: 07/21/2008
Juice: 9
Good Stuff

Good port dave. Excellent work

darksbane's picture
Joined: 07/09/2009
Juice: 15
Hey Dave, Having trouble

Hey Dave,

Thanks for your work on this, it is greatly appreciated!

I'm having trouble getting this to behave on Ubercart 2 RC3 though (have not tried on older versions yet). It seems to install and function correctly, except that it doesn't display a shipping price, I'm not sure whether it actually receives a quote from Austpost or not.

Any thoughts on what to look at would be great, has anyone else had it working on RC3?

Thanks everyone!


darksbane's picture
Joined: 07/09/2009
Juice: 15
Re: Hey Dave, Having trouble

Just tested using Ubercart 2 Beta 3 and I get the same thing. Is there something I'm missing?

snorcha's picture
Joined: 07/15/2009
Juice: 2
Re: Re: Hey Dave, Having trouble

The only way I can get this to work is if there is 2 or more products in the cart.

Works perfectly once that scenario is met tho.

darksbane's picture
Joined: 07/09/2009
Juice: 15
Hey Snorcha, I noticed there

Hey Snorcha,

I noticed there is a fix for that problem at http://www.ubercart.org/issue/10074/not_returning_quote_when_only_one_item

However, that doesn't seem to fix my problem either. I still can't see the quotes with two or more products.

darksbane's picture
Joined: 07/09/2009
Juice: 15
Re: Hey Snorcha, I noticed there

Ah, problem solved, simple little matter of forgetting to set a pick up address on the test site!

Once I added that and the change from http://www.ubercart.org/issue/10074/not_returning_quote_when_only_one_item it all works perfectly Smiling

Silly me.

drasgardian's picture
Joined: 10/20/2009
Juice: 2
not recognising failed requests

I found a couple of bugs with this contribution.

Firstly, it wasn't correctly recognising when a request failed. For example let's say I'm shipping one normal sized product and one very large (too big for auspost) product. The request for the first will succeed but the request for the second will fail. Currently it simply adds up the cost of the successful requests and uses that as the total, which in my example would lead to shipping the very large product for free!
- I have attached a patch that addresses this issue

The second bug that I found relates to when you select the 'All in one' option for packaging.
Using the example above where I'm shipping one normal sized product together with a very large product, I expected my request to be rejected by auspost, but it wasn't. This is because dimensions are hard-coded at 250mm if 'All in one' is selected.

      // Pass some bogus measurements to the eDRC. They have no bearing on the quote itself?
      $packages[$key][0]->length = 250;
      $packages[$key][0]->width = 250;
      $packages[$key][0]->height = 250;

- my patch doesn't address this. Perhaps someone else could have a crack at it?

uc_auspost_21102209.patch 2.06 KB
stevo_0's picture
Joined: 08/09/2009
Juice: 33
Re: uc_auspost_2

Ive noticed as well, that for international purchases.

If the customer has a space in the post code, an error is generated, even though the post code does not apply for international purchases.

Problem came about when a Canadian put there post code as

T3E 1M7

Which is how there postal structure works. However when the space was removed, it does work. eg T3E1M7

This should be a relatively simple fix? Thou hacking drupal modules is well beyond my scope for now.

Awesome module btw! =D


recieved these errors on the next page from a link in the Error Message for calc'ing Postal rates,


warning: file(http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=2095&Destination... 345&Country=CA&Weight=250&Service_Type=AIR&Length=250&Width=250&Height=250&Quantity=1) [function.file]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/0-web/08/cc/wildplanet.com.au/public/www/sites/all/modules/ubercart/contrib/uc_auspost/uc_auspost.module on line 352.


edit again:

ok worked a solution:

changed the bottom function in the module to the following

function uc_auspost_rate_request($package, $origin, $destination, $auspost_service) {
$shipto_country = uc_get_country_data(array('country_id' => $destination->country));
$shipto_country = $shipto_country[0]['country_iso_code_2'];

$request = variable_get('uc_auspost_uri',null);

$input = $destination->postal_code;
$output = str_replace(" ","",$input);

$request .= '?Pickup_Postcode='. $origin->postal_code.

return $request;

FastDesign's picture
Joined: 02/10/2010
Juice: 34
success runing aust post module on latest release of uc?

Is anyone running this module on the current release of uc? I've installed and configured it but when in checkout it doesn't get a response for 'calculating shipping costs' - it just sits there....


JohnTolhurst's picture
Joined: 03/29/2010
Juice: 25
time to roll up into a new beta?

There are a few code comments accumulated, I wonder if someone savvy could roll them into a new beta, it would help those of use whose php skills are deficient to still give feedback on the developing mod.

Very nice mod the way it configures etc ... but I'm not getting quotes coming up.

VladimirAus's picture
Joined: 06/30/2010
Juice: 8
Alpha 1

All above patches and suggestions are in Alpha1 package.
I don't ming to become contrubutor admin for this module.

uc_auspost-6.x-1.0-alpha1.zip 28.2 KB
JohnTolhurst's picture
Joined: 03/29/2010
Juice: 25
Re: time to roll up into a new beta?

Well, with proper post codes, both national and international quotes are coming up.

VladimirAus's picture
Joined: 06/30/2010
Juice: 8
Alpha 2

First one had duplicated function, so had an error during installation.

John, when do you think your updates are coming up?
Do you want to collaborate on that module and once it good enough to hit beta publish it to drupal website?

uc_auspost-6.x-1.0-alpha2.zip 28.14 KB
sime's picture
Joined: 08/14/2007
Juice: 19
let's get this on drupal.org?

@VladimirAus -- a dev version on any repository ASAP would be fantastic.

I wrote the ecommerce auspost .inc, (which doesn't ship with ec anymore and hasn't got a home currently)

Maybe we could create an auspost project on D.o that handles the logic for auspost with dynamic .inc integration to handle interact with the uc hooks. I also intend to move to commerceapi without having to duplicate the auspost logic, so maybe this the structure could cater for that:


I also have some packaging logic in my code.

willieseabrook's picture
Joined: 08/18/2009
Juice: 23
Re: uc_auspost_2

Further interest here. Am downloading your alpha2 zip to use on an Australian ecommerce site.

Will let you know and post back any fixes if I find issues.

willieseabrook's picture
Joined: 08/18/2009
Juice: 23
Re: Re: uc_auspost_2

The module itself works great.

Turned out we couldn't use it though, as my customer uses the prepaid satchels, not the standard package weight/dimension.

The auspost webservice doesn't consider satchel pricing.

He uses the prepaid satchels to get cheaper shipping. I.E In many cases the standard package shipping was coming back 2 or 3 times more expensive than the equivalent satchel.

Kris R's picture
Joined: 01/12/2011
Juice: 14
Re: uc_auspost_2

I just installed this module and it works brilliantly.

Thanks so much man.

afif227's picture
Joined: 11/30/2010
Juice: 54
Calculating Insurance in Aust Module

Does anyone can guide me how to go about implementing insurance within australian post module...

JimmyJC's picture
Joined: 04/19/2011
Juice: 5
Re: Calculating Insurance in Aust Module

I believe encountered a problem with the All in One function.

I have a number of prodcuts that have varying weights.

Product 1 weighs 6.5kg and is defined to have a Package Quantity of 1

Product 2 weighs 0.1kg and is defined to have a Package Quantity of 200

If I ship Product 1 and Product 2 to a customer, I ship Product 2 inside Product 1's packaging, (because it is so small).

Here is the problem:

If I checkout with 1 x Product 1, shipping to an international site, the quote comes back at ~$200 for Express Post International

If I then add 1 x Product 2 to the same order and checkout, the quote then comes back at ~$70.

If I create a new order with only 1 x Product 2, I also get a quote of ~$70.

It seems like Product 1's weight is not incorporated in the quote... Any ideas why?

larowlan's picture
Joined: 08/10/2008
Juice: 83
Hi Dave Any plans to make

Hi Dave
Any plans to make this a fully-fledged project on Drupal.org - even as a sandbox?
I'd be willing to review the project with a view to it getting promoted to a fully fledged project.

dave's picture
Joined: 12/21/2008
Juice: 40
Hi Lee, Funny thing is that I

Hi Lee,

Funny thing is that I never got around to use this module in the wild and now I'm building a shop in Drupal commerce.

It looks like ValdimirAus is working on this module so it may be best to see if he wants to set it up on Drupal.org. I think it's a good idea though.


AD's picture
Joined: 07/05/2011
Juice: 16
Re: uc_auspost_2

A README.txt containing the setup steps would be great

I've created a simple conditional module for testing dimensions that could be useful. http://www.ubercart.org/project/uc_dimensional_conditions

The limits on a single package are 20kg (core ubercart) or 105cm max dimension or 140cm girth (the new module provides this)

bensey's picture
Joined: 07/20/2011
Juice: 16
Anyone good at D7 porting?


I really need this for a D7 project and attemted a port using the upgrade service at boombatower.com, but I can't get it to work correctly.
All the admin and config seems to work ok, but it doesn't deliver postage rates to the checkout.

I'm not a huge whiz with this kind of thing, anyone interested in taking a look?

d7_port_uc_auspost-6.x-1.0-alpha2.tar.gz 32.71 KB
gurname's picture
Joined: 11/30/2012
Juice: 15

Thanks for giving module but its not work for me please tell me the proper settings of this module.I checked on methods and also add flat rate it show me the flat rate but not the other methods.

Can any body know the reason?

Thanks in advance