Division by Zero ... only Warning

  • Posts: 69
  • Thank you received: 5
2 years 9 months ago #339239

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

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 9 months ago #339254

Hi,

Thank you for your feedback.
We'll fix this by adding the code:

if(empty($total)) {
			return $taxes;
		}
before the code:
		foreach($products as $product){
			if(empty($product->prices) || empty($product->prices[0]->taxes))
				continue;
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.

Last edit: 2 years 9 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.060 seconds
Powered by Kunena Forum