Post by renepotvin » Wed Jan 01, 2014 3:11 am

The UPS extension is not working and I get this error message...

PHP Warning: Division by zero in /home/xxx/public_html/system/library/currency.php on line 114

Anyone found an answer to this problem?
Last edited by renepotvin on Wed Jan 01, 2014 3:25 am, edited 1 time in total.

Newbie

Posts

Joined
Sun Dec 29, 2013 3:20 am

Post by renepotvin » Wed Jan 01, 2014 3:21 am

I found a quick way to get around it but I wouldn't call it an answer

I went into currency.php and changed the default value of $from to 1 instead of 0.

If you want to go that way :
It's on line 105... change $from=0 to $from=1

This means I'm not getting any currency updates or something. :-[

Newbie

Posts

Joined
Sun Dec 29, 2013 3:20 am

User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by renepotvin » Fri Jan 03, 2014 1:34 am

I'm in canada but I put US as default on opencart

Newbie

Posts

Joined
Sun Dec 29, 2013 3:20 am

Post by Qphoria » Fri Jan 17, 2014 6:02 am

That isn't the fix.. the real issue is that you are using UPS to get shipping rates and don't have the correct currency setup on your site needed for conversion.

This usually happens for people in Canada that use "CDN" for their currency code when the correct ISO standard code is "CAD" which is what UPS returns. Then tries to calculate the conversion from USD to CAD and you only have CDN so it divides by a non-existent value which php turns into 0.

It is true that the currency library could do a better job handling the issue but really it might mask the underlying problem because the solution would be to simply return 0 or maybe NaN if possible but won't explain the issue was caused by the zero divide.

Take a look at the debug message for UPS in the system error logs area to see what currency UPS is returning.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by renepotvin » Sat Jan 25, 2014 3:23 am

Hum, I use USD.

Newbie

Posts

Joined
Sun Dec 29, 2013 3:20 am

Post by Qphoria » Wed Jan 29, 2014 5:42 am

If you enable UPS debug then check what currency UPS is sending back. They always send back the "origin" currency so if you use USD but your origin address is setup from Canada then it will send back prices in CAD. You can be sure by checking the system error log when you have ups debug enabled

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: No registered users and 1 guest