[Skip to main content](#vessel-content)

#   Hikashop + AkeebaSubs PHP Error

##

- **[rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")**
- [![rotodyne's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/23066-rotodyne "View rotodyne's Profile") Topic Author
- [ Offline](/forum/user/23066-rotodyne)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 4 months ago [\#111414](#111414) by [rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")  *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#111414 "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")* was created by *[rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")**
- [![rotodyne's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/23066-rotodyne "View rotodyne's Profile") Topic Author
- [ Offline](/forum/user/23066-rotodyne)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 4 months ago [\#111441](#111441) by [rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")  Replied by *[rotodyne](/forum/user/23066-rotodyne "View rotodyne's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#111441 "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")*

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 ![:)](/media/kunena/emoticons/8.png ":)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

13 years 4 months ago [\#111443](#111443) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#111443 "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")*

Hi,

The line that you pointed is: Code:

if(!empty($result-&gt;order_product_price)) $taxPercent = round($result-&gt;order_product_tax / $result-&gt;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 &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[joji](/forum/user/25217-joji "View joji's Profile")**
- [![joji's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/25217-joji "View joji's Profile")
- [ Offline](/forum/user/25217-joji)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 3 months ago [\#116343](#116343) by [joji](/forum/user/25217-joji "View joji's Profile")  Replied by *[joji](/forum/user/25217-joji "View joji's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#116343 "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")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 3 months ago [\#116436](#116436) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#116436 "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")*

Hi,

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[joji](/forum/user/25217-joji "View joji's Profile")**
- [![joji's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/25217-joji "View joji's Profile")
- [ Offline](/forum/user/25217-joji)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 2 months ago [\#116667](#116667) by [joji](/forum/user/25217-joji "View joji's Profile")  Replied by *[joji](/forum/user/25217-joji "View joji's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#116667 "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")*

Hi,
Yes, I am running V2.2.0

thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 2 months ago [\#116765](#116765) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#116765 "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")*

Hi,

Line 158 of the akeebasubs plugin, you have to change the line: Code:

if(!empty($result-&gt;order_product_price)) $taxPercent = round($result-&gt;order_product_tax / $result-&gt;order_product_price * 100, 2);

By: Code:

if(!empty($result-&gt;order_product_price) &amp;&amp; hikashop_toFloat($result-&gt;order_product_price) != 0.0) $taxPercent = round($result-&gt;order_product_tax / $result-&gt;order_product_price * 100, 2);

The following user(s) said Thank You: [joji](/forum/user/25217-joji "View joji's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[joji](/forum/user/25217-joji "View joji's Profile")**
- [![joji's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/25217-joji "View joji's Profile")
- [ Offline](/forum/user/25217-joji)

Less More

- Posts: 5
- Thank you received: 0
-
-

13 years 2 months ago [\#116866](#116866) by [joji](/forum/user/25217-joji "View joji's Profile")  Replied by *[joji](/forum/user/25217-joji "View joji's Profile")* on topic *[Hikashop + AkeebaSubs PHP Error](/forum/4-how-to/84321-hikashop-akeebasubs-php-error#116866 "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")*

Thanks, that worked!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzg0MzIxLWhpa2FzaG9wLWFrZWViYXN1YnMtcGhwLWVycm9yP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.158 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
