- Posts: 69
- Thank you received: 5
Division by Zero ... only Warning
- politikchronist
-
Topic Author
- Offline
Less
More
4 years 8 months ago #339239
by politikchronist
Division by Zero ... only Warning was created by politikchronist
-- url of the page with the problem -- :
www.politikchronist.org
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.5
-- Error-message(debug-mod must be tuned on) -- : Division by zero
Hello,
not urgent because seldom happening. When giving 100% discount on article and coupon of 100% for delivery cost, the following warning appears:
Warning: Division by zero in /var/www/html/joomla/administrator/components/com_hikashop/classes/currency.php on line 2334
The result nevertheless is correct.
Thanks for comments.
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.5
-- Error-message(debug-mod must be tuned on) -- : Division by zero
Hello,
not urgent because seldom happening. When giving 100% discount on article and coupon of 100% for delivery cost, the following warning appears:
Warning: Division by zero in /var/www/html/joomla/administrator/components/com_hikashop/classes/currency.php on line 2334
The result nevertheless is correct.
Thanks for comments.
Please Log in or Create an account to join the conversation.
4 years 8 months ago - 4 years 8 months ago #339254
by nicolas
Replied by nicolas on topic Division by Zero ... only Warning
Hi,
Thank you for your feedback.
We'll fix this by adding the code:
before the code:
in that file a bit before the line of the warning.
The error happens because the system tries to get the taxes of the products to calculate the taxes on the shipping fee, but since the amount is 0, it tries to divide by 0 during the calculations, instead of skipping the caclulation process and just returning no taxes (which is what this patch does).
We'll add that for the next version of HikaShop.
Thank you for your feedback.
We'll fix this by adding the code:
Code:
if(empty($total)) {
return $taxes;
}
Code:
foreach($products as $product){
if(empty($product->prices) || empty($product->prices[0]->taxes))
continue;
The error happens because the system tries to get the taxes of the products to calculate the taxes on the shipping fee, but since the amount is 0, it tries to divide by 0 during the calculations, instead of skipping the caclulation process and just returning no taxes (which is what this patch does).
We'll add that for the next version of HikaShop.
Last edit: 4 years 8 months ago by nicolas.
The following user(s) said Thank You: politikchronist
Please Log in or Create an account to join the conversation.
Time to create page: 0.152 seconds