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?
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.
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.
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.

what's your default currency?
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest