Jump to content
Sign in to follow this  
lordofcb

Problems with AusPost Calculations

Recommended Posts

OK, The last two releases have been bundled in the one download, the latest release (with the probelm fixed) uses curl to call the drc, the previous release (with no problem) uses fopen to call the drc.

The number of days estimated for delivery as obtained from the drc is not displayed. I think the problem is the way the data is handled by the modules. The result from the drc is in 3 lines, cost, days, and error message. The cost is displayed. Here is the part of the code that handles the curl

 

$newtopcode = str_replace(" ", "", $topcode);

/**

* Initialize the cURL session

*/

$ch = curl_init();

/**

* Set the URL of the page or file to download.

*/

curl_setopt($ch, CURLOPT_URL,

"http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$newtopcode&Country=$dest_country&Weight=$sweight&Service_Type=AIR&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes");

/**

* Ask cURL to return the contents in a variable

* instead of simply echoing them to the browser.

*/

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

/**

* Execute the cURL session

*/

$contents = curl_exec ($ch);

/**

* Close cURL session

*/

curl_close ($ch);

{

$bits = split("=" ,$contents);

$$bits[0] = $bits[1];

}

 

if ($charge <= 0) {

$error = true;

} else {

 

$handling = MODULE_SHIPPING_AUSPOSTAIR_HANDLING;

 

Does anyone have an idea?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Hi all

 

I've just had a look at the International parts of this for a client and (as mentioned elsewhere in the thread - sorry if somebody has already replied to it) the rates returned appear to be net of Aus GST (currently 10%).

 

This is obviously a pain as, at the Post Office, the GST is added and you are 10% worse off.

 

I looked into the code and found (Line 116 Auspostsea.php and line 116 Auspostair.php (example from auspostair)

$shipping_auspostair_cost = (($charge/1.1)* $shipping_num_boxes);

remove the /1.1 to restore the correct value

$shipping_auspostair_cost = (($charge)* $shipping_num_boxes);

Graeme

Edited by sakwoya

Share this post


Link to post
Share on other sites
Hi all

 

I've just had a look at the International parts of this for a client and (as mentioned elsewhere in the thread - sorry if somebody has already replied to it) the rates returned appear to be net of Aus GST (currently 10%).

 

This is obviously a pain as, at the Post Office, the GST is added and you are 10% worse off.

 

I looked into the code and found (Line 116 Auspostsea.php and line 116 Auspostair.php (example from auspostair)

$shipping_auspostair_cost = (($charge/1.1)* $shipping_num_boxes);

remove the /1.1 to restore the correct value

$shipping_auspostair_cost = (($charge)* $shipping_num_boxes);

Graeme

If you are charged the gst by the PO then you pass that on. The only way around it is to purchase special gst free stamps. With that said, if you do not get the gst free stamps, then you have the gst added by setting the correct tax zone in the module.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Hi

Sorry if I am muddying the waters a little (I'm in the UK so correct me if I have this wrong but I assume your GST is like our VAT?)

 

The online store I am working on is not GST registered so she is not charging any tax anywhere in the osC installation - hence if she does not have the Auspost fee incl GST charged at the checkout then she is losing 10% on the postage. She can't tick the 'use tax on shipping module' option as there are no tax zones setup.

 

Hacking out the 1.1 looks to be the only way (other than buying the non-GST stamps that you mention) that she can get around this other than registering for GST??

 

Graeme

Share this post


Link to post
Share on other sites
Hi

Sorry if I am muddying the waters a little (I'm in the UK so correct me if I have this wrong but I assume your GST is like our VAT?)

 

The online store I am working on is not GST registered so she is not charging any tax anywhere in the osC installation - hence if she does not have the Auspost fee incl GST charged at the checkout then she is losing 10% on the postage. She can't tick the 'use tax on shipping module' option as there are no tax zones setup.

 

Hacking out the 1.1 looks to be the only way (other than buying the non-GST stamps that you mention) that she can get around this other than registering for GST??

 

Graeme

You can set up the gst tax zone and apply it only to the austpost shipping modules. You will not be charging gst on any purchases, just recouping the cost of gst on shipping.

 

In the future, if the store does become big enough to be registered for gst, it is easier to swap over (tax zone set up, no fiddling the module code).

 

I don't think you can get the gst free stamps unless you are registered for gst.

 

Anyway, it is your choice what you do.

 

BTW, are you using the curl enabled option or the fopen option. Do the number of estimated days for delvery show?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

G'day.

 

I was just looking into this, bit of a coincidence on the timing. :)

 

Replace:

{
 $bits = split("=" ,$contents);
 $$bits[0] = $bits[1];
}

 

with:

 

								$vals = split("\n", $contents);
							foreach ($vals as $value) {

											$bits = split("=" ,$value);
											$$bits[0] = $bits[1];
							}

 

This only applies to the curl method - because it reads it in as one variable instead of an array.

 

Enjoy.

Share this post


Link to post
Share on other sites
G'day.

 

I was just looking into this, bit of a coincidence on the timing. :)

 

Replace:

{
 $bits = split("=" ,$contents);
 $$bits[0] = $bits[1];
}

 

with:

 

								$vals = split("\n", $contents);
							foreach ($vals as $value) {

											$bits = split("=" ,$value);
											$$bits[0] = $bits[1];
							}

 

This only applies to the curl method - because it reads it in as one variable instead of an array.

 

Enjoy.

Hi Yelsaeb

 

Thank you, you have just saved my sanity. Your solution works perfectly. I spent 2 weeks trying to work that one out.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Australia Post 3.011c has been uploaded to the contributions area.

 

Zip file contains Australia Post 3.011 by venom54 and Australia Post 3.01 by toptiara. Credit goes to these two contributors and the earlier contributors. Australia Post 3.011 was making an incorrect call to the drc in the express and sea modules.

 

The problem with not displaying the number of days has been fixed thanks to Yelsaeb (Patrick Beasley).

 

A few superflous lines removed from some of the language files, error message changed in all language files of both versions.

 

If your web has stopped fopen, use Australia Post 3.011, otherwise use Australia Post 3.01 if you want.

 

Complete package for fresh install.

 

I wanted to get the use of curl selectable in Admin, so that both options were available in the one files, but I could not get it to work.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Hi,

I've downloaded the 3.11c contribution, read this entire forum, and even done a google search, but I cannot find out what this means...

 

If your web has stopped fopen, use Australia Post 3.011

 

Would someone please enlighten me as to what 'stopped fopen' means?

 

I want to get this module working on my site, but to tell the truth, am petrified I may instead mess up the site - it works, apart from the austpost calculations! The fact that I have no idea where to start doesn't help, but I don't want to install the wrong contribution as I wouldn't know how to either fix it, or repair it.

 

Thanks in advance.


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
You can set up the gst tax zone and apply it only to the austpost shipping modules. You will not be charging gst on any purchases, just recouping the cost of gst on shipping.

 

In the future, if the store does become big enough to be registered for gst, it is easier to swap over (tax zone set up, no fiddling the module code).

 

I don't think you can get the gst free stamps unless you are registered for gst.

 

Anyway, it is your choice what you do.

 

BTW, are you using the curl enabled option or the fopen option. Do the number of estimated days for delvery show?

Hi

Looks like your CURL question has already been answered :-))

 

My preference would be to setup the GST as I think the store may well fall into the GST turnover bracket (it's half of the UK one - your GST is also a lot less than our VAT (17.5%) but some other EU countries run up to 25%).

I've found the International rate set at $8.45 for the first $100 and $8.45 per $100 or part thereof after that - Can you confirm that the domestic insurance should be $4.35 for the first $100 and then $1.15 after that - I've been trawling the Auspost website but, for some reason, I cannot find the domestic insurance rates??

 

Regards

 

Graeme

Share this post


Link to post
Share on other sites
Hi

Looks like your CURL question has already been answered :-))

 

My preference would be to setup the GST as I think the store may well fall into the GST turnover bracket (it's half of the UK one - your GST is also a lot less than our VAT (17.5%) but some other EU countries run up to 25%).

I've found the International rate set at $8.45 for the first $100 and $8.45 per $100 or part thereof after that - Can you confirm that the domestic insurance should be $4.35 for the first $100 and then $1.15 after that - I've been trawling the Auspost website but, for some reason, I cannot find the domestic insurance rates??

 

Regards

 

Graeme

International rate set at $8.45 for the first $100 and $2.25 per $100 or part thereof after that up to $5,000

Domestically, I think it is only available with registered post $2.75 per parcel plus postage plus $1.25 per $100 in excess of $100 up to $5000 plus $1.85 delivery confirmation

 

The name insurance has been changed to extra cover (if that helps).


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
Hi,

I've downloaded the 3.11c contribution, read this entire forum, and even done a google search, but I cannot find out what this means...

 

 

 

Would someone please enlighten me as to what 'stopped fopen' means?

 

I want to get this module working on my site, but to tell the truth, am petrified I may instead mess up the site - it works, apart from the austpost calculations! The fact that I have no idea where to start doesn't help, but I don't want to install the wrong contribution as I wouldn't know how to either fix it, or repair it.

 

Thanks in advance.

It can hardly mess up the site. So you are using austpost calculations already?

 

Install one, if that does not work, try the other. If that does not work, try a zones module.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
International rate set at $8.45 for the first $100 and $2.25 per $100 or part thereof after that up to $5,000

Domestically, I think it is only available with registered post $2.75 per parcel plus postage plus $1.25 per $100 in excess of $100 up to $5000 plus $1.85 delivery confirmation

That's lovely - many thanks I can get the module setup now with the new insurance options in it.

 

Graeme

Share this post


Link to post
Share on other sites
It can hardly mess up the site. So you are using austpost calculations already?

 

Yes the website has only the auspost module installed but its calculations are incorrect. For example, it charges $4.91 to send a .5kg parcel. It seems to like that 1c. No matter the weight, the cost it calculates is always wrong and always ends in 1c.

 

Install one, if that does not work, try the other. If that does not work, try a zones module.

 

I've never installed anything before, I bought the website mostly working from someone. Once I work out how to get the site backed up I have to attempt the modules as it's no good as it is. It just charged someone 11.91 for 2x.25kg items. Not the best way to keep a customer.


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
Yes the website has only the auspost module installed but its calculations are incorrect. For example, it charges $4.91 to send a .5kg parcel. It seems to like that 1c. No matter the weight, the cost it calculates is always wrong and always ends in 1c.

 

 

 

I've never installed anything before, I bought the website mostly working from someone. Once I work out how to get the site backed up I have to attempt the modules as it's no good as it is. It just charged someone 11.91 for 2x.25kg items. Not the best way to keep a customer.

Well, what tare weight is set in admin, are your tax rates set up correctly, did you use a handling fee, etc?

 

You say it costs $4.91 to send a .5kg parcel. From where to where, and in which module? Are you including insurance, there are so many unknown variables that your question can't be answered.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
Well, what tare weight is set in admin, are your tax rates set up correctly, did you use a handling fee, etc?

 

You say it costs $4.91 to send a .5kg parcel. From where to where, and in which module? Are you including insurance, there are so many unknown variables that your question can't be answered.

 

Hi Coopco,

The max shipping weight is set to 20kg as this is the Auspost limit.

The tare weight is set to .25kg.

I don't have any tax rates.

The handling fee is $3.00 This makes the cost to send a .25kg parcel $7.91.

When I remove the $3.00 handling fee, it calculates $4.91 to ship a .25 kg item

All items in my store have a weight of .25kg plus the .25kg tare weight, this equals the .5kg weight I mentioned.

However, the information displayed in checkout still only says it is a .25kg parcel and does not include the tare weight when it displays the total package weight.

 

I put the postcodes in as from 5000 to 2000. As it is only .5kg or .25kg, it matters not what postcode as these go on weight, not distance. It isn't until it it over .5kg that the weight and cubing factors come in to effect I believe.

Regards

Colleen


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
Hi Coopco,

The max shipping weight is set to 20kg as this is the Auspost limit.

The tare weight is set to .25kg.

I don't have any tax rates.

The handling fee is $3.00 This makes the cost to send a .25kg parcel $7.91.

When I remove the $3.00 handling fee, it calculates $4.91 to ship a .25 kg item

All items in my store have a weight of .25kg plus the .25kg tare weight, this equals the .5kg weight I mentioned.

However, the information displayed in checkout still only says it is a .25kg parcel and does not include the tare weight when it displays the total package weight.

 

I put the postcodes in as from 5000 to 2000. As it is only .5kg or .25kg, it matters not what postcode as these go on weight, not distance. It isn't until it it over .5kg that the weight and cubing factors come in to effect I believe.

Regards

Colleen

To the best of my knowledge, cubing is no longer used.

 

The tare weight is, I beleive, used in calculations (you can try it by changing the tare weight).

 

The small parcel rate is for parcels up to 500g, up to 250g $4.20, up to 500g $5.40.

 

I believe the error is because you do not apply the 10% GST to the shipping cost ($5.40/1.1 is done in the module). If you correctly set up a tax class for GST, and apply that to the shipping module, the prices should be correct.

 

See how that goes and let us know.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
I believe the error is because you do not apply the 10% GST to the shipping cost ($5.40/1.1 is done in the module). If you correctly set up a tax class for GST, and apply that to the shipping module, the prices should be correct.

 

See how that goes and let us know.

Hi Coopco,

Thank you for that information. I have set the Tax Rate in the shipping module. I also checked that the Tax Rate in Locations/Taxes was set to 10% and Tax Classes was set up for Taxable Goods.

 

It still does not add the 10% to the Shipping Module. For example, a .25kg parcel, with $0 handling, comes up as $3.82 to post. This is the $4.20 less GST.

 

Is there somewhere else I should set this? Or is it possible that it isn't working and needs to be fixed?

 

Appreciate any help with this.

 

Thankyou,

Colleen


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
Hi Coopco,

Thank you for that information. I have set the Tax Rate in the shipping module. I also checked that the Tax Rate in Locations/Taxes was set to 10% and Tax Classes was set up for Taxable Goods.

 

It still does not add the 10% to the Shipping Module. For example, a .25kg parcel, with $0 handling, comes up as $3.82 to post. This is the $4.20 less GST.

 

Is there somewhere else I should set this? Or is it possible that it isn't working and needs to be fixed?

 

Appreciate any help with this.

 

Thankyou,

Colleen

In all of the austpost modules, you now need to set the Tax Class to whatever you called the GST tax (mine is called Australian GST). So from what you said, it should work.

 

As a test that the tax rate is set up correctly, apply the tax rate to a product in your admin, have display prices with tax set to true, and see if the catalog side now shows the price for that product including tax.

Edited by Coopco

The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
As a test that the tax rate is set up correctly, apply the tax rate to a product in your admin, have display prices with tax set to true, and see if the catalog side now shows the price for that product including tax.

 

It did and did not work. I set the Tax Class to Taxable Goods. The Products Price (net) was $14.99 and it immediately displayed the Products Price (Gross) as $16.489.

I did remember to update it.

 

It continues to display the price as $14.99, both in Catalog and on the price in the store. If I edit the product again, the taxable rate of $16.489 is still there.

 

So I guess I'm missing something somewhere.


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
It did and did not work. I set the Tax Class to Taxable Goods. The Products Price (net) was $14.99 and it immediately displayed the Products Price (Gross) as $16.489.

I did remember to update it.

 

It continues to display the price as $14.99, both in Catalog and on the price in the store. If I edit the product again, the taxable rate of $16.489 is still there.

 

So I guess I'm missing something somewhere.

In your admin my store

Display Prices with Tax

Display prices with tax included (true) or add the tax at the end (false)

set to true

 

Apart from that, there is in Locations \taxes

 

Tax Zones

 

Tax Classes

 

and

 

Tax Rates


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
In your admin my store

Display Prices with Tax

Display prices with tax included (true) or add the tax at the end (false)

set to true

 

I set that as above, but it made no difference. That's okay, by the time my store earns enough to have to worry about GST I might have a bit more knowledge.

 

On another note, having searched the contributions, I found one made for Aus Post satchels and express post satchels. This was what I wanted all along.

 

I put these in and they worked immediately, so I wanted to thank you for the contributions.

 

As I sell childrens clothes, all I really need to use is the satchels.

 

Thank you.

Colleen


Everything's easy when you know how.

Share this post


Link to post
Share on other sites
I set that as above, but it made no difference. That's okay, by the time my store earns enough to have to worry about GST I might have a bit more knowledge.

 

On another note, having searched the contributions, I found one made for Aus Post satchels and express post satchels. This was what I wanted all along.

 

I put these in and they worked immediately, so I wanted to thank you for the contributions.

 

As I sell childrens clothes, all I really need to use is the satchels.

 

Thank you.

Colleen

OK, but the aust post modules still should show the price inc gst, but I don't know hy yours aren't.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

G'day again.

 

Noticed another problem with orders > 20kg. When the max weight of packages is set in the osCommerce admin (ie. "Enter the Maximum Package Weight you will ship" under Configuration > Shipping/Packaging) the order is split up into separate packages automatically.

 

This is then fed to the Australia Post site, along with the weight for only a single package, thus getting an incorrect result. In addition to this, down lower in the auspost shipping module the result is then multiplied by the number of packages, so making the error even more pronounced (eg. for a very large order of 9 packages, the already wrong result back from Australia Post is then multiplied by 9).

 

To get the correct result:

 

Change the line beginning with "http://drc.edeliver.com.au" so that it has '&Quantity=1");' in the end instead of '&Quantity=$shipping_num_boxes");'. That way you're only getting the price for one of the packages from Australia Post and then multiplying it later.

 

I need to do a few more tests on this to make sure that the correct price is always returned, so don't go updating the contribution just yet unless you can test and verify this yourself.

Edited by Yelsaeb

Share this post


Link to post
Share on other sites

An update on this - using the method described above works only when multiple items of the same size are ordered, needs quite a bit of rewriting to get an accurate result for different items, as the call to get the price will need to be done once per parcel, not just once.

 

Sorry for the delay here, I got stuck working on other modules for the last couple of weeks.

Edited by Yelsaeb

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×