Forums / Addon Shipping Modules / Need Help to fix bug in Australia Post Shipping Module

Need Help to fix bug in Australia Post Shipping Module

Locked

Started by peter_homann on 2 Aug 2006, 2:05 AM · Views: 2,460

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
2 Aug 2006, 2:05 AM
#1
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Need Help to fix bug in Australia Post Shipping Module

Hi,

I have found a bug with the Australia Post Shipping module and require help in fixing it. I believe that I know what needs to be done but I don't have an indepth knowledge of the ZenCart software or php.

In australia_post_module_3.02.zip file \catalog\includes\modules\shipping\auspostair.php line 120 states

    ```

$shipping_auspostair_cost = $charge;


where **$charge** is the value returned ifrom the Australia Post Shipping calculator called in line 80.

[http://drc.edeliver.com.au](http://drc.edeliver.com.au)

The value returned in **$charge** **Is always in Australian Dollars AUD**

Then, in line 112 we have;

$shipping_auspostair_cost = $charge;


and in line 115 we have

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_AUSPOSTAIR_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => $shipping_auspostair_method,
'cost' => ($shipping_auspostair_cost + MODULE_SHIPPING_AUSPOSTAIR_HANDLING) + $insurance)));



The bug is that **MODULE_SHIPPING_AUSPOSTAIR_HANDLING** and **$insurance** are in the Admin set default currency, not necessarly Australian dollars AUD.

In my case I have set the Default currency to USD$. With the code as it is, it is interpreting the value in **$charge** as USD$

That is; when the calculator returns $8.50 for a postage charge, the module is interpreting it as **USD$8.50, not AUD$8.50 **

This results in the customer being over charged!

As I see it, the fix is extremely simple. the value **$charge
** returned by the Australia Post calculator needs to be divided by the AUD currency rate to convert it to the default currency. Something like;

replace line 112 with;

$shipping_auspostair_cost = $charge/ AUD_CURRENCY_RATE;



How do I replace AUD_CURRENCY_RATE with the AUD currency rate set under Admin->Localization->Curriencies?

Or is there a conversion routine I can call?

I tried;

$shipping_auspostair_cost = $charge/ currencies->value(AUD);



but it didn't work :( 

I presume I need to also do some type conversion/formating as well


Can someone please help me? I'm desperate.


Thanks,

Peter