- Posts: 5
- Thank you received: 0
Hikashop + AkeebaSubs PHP Error
13 years 3 months ago #111414
by rotodyne
Hikashop + AkeebaSubs PHP Error was created by rotodyne
I have a free product that gets added to the cart and then checked out. Everything works great, and the transaction goes through, but I get this warning message.
Warning: Division by zero in /home/content/14/9851214/html/plugins/hikashop/akeebasubs/akeebasubs.php on line 158
I am assuming it is because somewhere the price or total is = 0. Is there anyway I can suppress or fix this warning?
Thanks
Warning: Division by zero in /home/content/14/9851214/html/plugins/hikashop/akeebasubs/akeebasubs.php on line 158
I am assuming it is because somewhere the price or total is = 0. Is there anyway I can suppress or fix this warning?
Thanks
Please Log in or Create an account to join the conversation.
13 years 3 months ago #111441
by rotodyne
Replied by rotodyne on topic Hikashop + AkeebaSubs PHP Error
I suppressed the warning with
@error_reporting(0);
@ini_set('display_errors', 0);
not a real fix, but it will have to do for now
@error_reporting(0);
@ini_set('display_errors', 0);
not a real fix, but it will have to do for now
Please Log in or Create an account to join the conversation.
13 years 3 months ago #111443
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Hikashop + AkeebaSubs PHP Error
Hi,
The line that you pointed is:
Problem is, if you have a free product, it should be see as empty in the if. This test is here to not make a division by zero.
Do you have this same code in your line 158 ?
Regards,
The line that you pointed is:
Code:
if(!empty($result->order_product_price)) $taxPercent = round($result->order_product_tax / $result->order_product_price * 100, 2);
Do you have this same code in your line 158 ?
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
13 years 2 months ago #116343
by joji
Replied by joji on topic Hikashop + AkeebaSubs PHP Error
I am having the same error on line 158 and I don't understand what you mean ...
I have products that aren't free by default but have discounts that make them free and for those it works fine without an error. However, when using with Akeeba Subscriptions, I get the error.
thanks!
I have products that aren't free by default but have discounts that make them free and for those it works fine without an error. However, when using with Akeeba Subscriptions, I get the error.
thanks!
Please Log in or Create an account to join the conversation.
13 years 2 months ago #116436
by Xavier
Replied by Xavier on topic Hikashop + AkeebaSubs PHP Error
Hi,
Do you have the latest version of HikaShop ? V2.2.0 ?
Do you have the latest version of HikaShop ? V2.2.0 ?
Please Log in or Create an account to join the conversation.
13 years 2 months ago #116667
by joji
Replied by joji on topic Hikashop + AkeebaSubs PHP Error
Hi,
Yes, I am running V2.2.0
thanks
Yes, I am running V2.2.0
thanks
Please Log in or Create an account to join the conversation.
13 years 2 months ago #116765
by Xavier
Replied by Xavier on topic Hikashop + AkeebaSubs PHP Error
Hi,
Line 158 of the akeebasubs plugin, you have to change the line:
By:
Line 158 of the akeebasubs plugin, you have to change the line:
Code:
if(!empty($result->order_product_price))
$taxPercent = round($result->order_product_tax / $result->order_product_price * 100, 2);
Code:
if(!empty($result->order_product_price) && hikashop_toFloat($result->order_product_price) != 0.0)
$taxPercent = round($result->order_product_tax / $result->order_product_price * 100, 2);
The following user(s) said Thank You: joji
Please Log in or Create an account to join the conversation.
13 years 2 months ago #116866
by joji
Replied by joji on topic Hikashop + AkeebaSubs PHP Error
Thanks, that worked!
Please Log in or Create an account to join the conversation.
Time to create page: 0.240 seconds