Skip to main content

Hikashop + AkeebaSubs PHP Error

More
13 years 3 months ago #111414 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

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

More
13 years 3 months ago #111441 by rotodyne
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 :)

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

More
13 years 3 months ago #111443 by Jerome
Hi,

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);
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,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
13 years 2 months ago #116343 by joji
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!

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

More
13 years 2 months ago #116436 by Xavier
Hi,

Do you have the latest version of HikaShop ? V2.2.0 ?

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

More
13 years 2 months ago #116667 by joji
Hi,
Yes, I am running V2.2.0

thanks

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

More
13 years 2 months ago #116765 by Xavier
Hi,

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);
By:
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.

More
13 years 2 months ago #116866 by joji
Thanks, that worked!

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

Time to create page: 0.240 seconds
Powered by Kunena Forum