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

#   Rounding problem with product prices

##

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

Less More

- Posts: 20
- Thank you received: 0
-
-

13 years 7 hours ago [\#134180](#134180) by [Jeffq](/forum/user/28397-jeffq "View Jeffq's Profile")  *[Rounding problem with product prices](/forum/29-payment-methods/863918-rounding-problem-with-product-prices#134180 "Hi,  On a few of my products, I'm having a price rounding problem. The saved price is not the one input by the the user.  I configured one of them at 35€ (in price with tax), but when I save, it turns into 34.99999516 (FYI, tax is 19.6)  On the front end, it does appear as 35.00€. When I proceed to checkout, it still appears as 35.00, but when I'm transferred to the payment gateway, the amount charged is 34.99.  This happens with the hikashop systempay module (French banks), and not with the paypal module.  I'm guessing the systempay module doesn't round up the price the way the paypal module does. But since the price stored in database is 34.99999516, it seems to me the problem is with the tax calculation, and not with this payment module, right? Is there anyway to force hikashop to save Exactly the price with tax input by the merchant?  It's the only problem preventing me from launching my site :)  Thanks in advance.  Regards Hikashop 2.2.2 Joomla 2.5  PS: I've posted this on an archived topic, not sure if I should have, so I created a new one... apologies for the mess")* was created by *[Jeffq](/forum/user/28397-jeffq "View Jeffq's Profile")*

Hi,

On a few of my products, I'm having a price rounding problem. The saved price is not the one input by the the user.

I configured one of them at 35€ (in price with tax), but when I save, it turns into 34.99999516 (FYI, tax is 19.6)

On the front end, it does appear as 35.00€. When I proceed to checkout, it still appears as 35.00, but when I'm transferred to the payment gateway, the amount charged is 34.99.

This happens with the hikashop systempay module (French banks), and not with the paypal module.

I'm guessing the systempay module doesn't round up the price the way the paypal module does. But since the price stored in database is 34.99999516, it seems to me the problem is with the tax calculation, and not with this payment module, right? Is there anyway to force hikashop to save Exactly the price with tax input by the merchant?

It's the only problem preventing me from launching my site ![:)](/media/kunena/emoticons/3.png ":)")

Thanks in advance.

Regards
Hikashop 2.2.2
Joomla 2.5

PS: I've posted this on an archived topic, not sure if I should have, so I created a new one... apologies for the mess

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

12 years 11 months ago [\#134375](#134375) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Rounding problem with product prices](/forum/29-payment-methods/863918-rounding-problem-with-product-prices#134375 "Hi,  On a few of my products, I'm having a price rounding problem. The saved price is not the one input by the the user.  I configured one of them at 35€ (in price with tax), but when I save, it turns into 34.99999516 (FYI, tax is 19.6)  On the front end, it does appear as 35.00€. When I proceed to checkout, it still appears as 35.00, but when I'm transferred to the payment gateway, the amount charged is 34.99.  This happens with the hikashop systempay module (French banks), and not with the paypal module.  I'm guessing the systempay module doesn't round up the price the way the paypal module does. But since the price stored in database is 34.99999516, it seems to me the problem is with the tax calculation, and not with this payment module, right? Is there anyway to force hikashop to save Exactly the price with tax input by the merchant?  It's the only problem preventing me from launching my site :)  Thanks in advance.  Regards Hikashop 2.2.2 Joomla 2.5  PS: I've posted this on an archived topic, not sure if I should have, so I created a new one... apologies for the mess")*

Hi,

The problem is with the systempay plugin which doesn't round the price correctly before sending it to the payment gateway.
It's normal that the price are stored like that. That's because of the tax calculation which is done based on the price without tax.
It needs to store the decimals so that it can properly sum the products/quantities/etc without loosing precision so that it is valid accounting-wise.

I guess that the line:
$amount = $order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax;

should be :
$amount = round($order-&gt;cart-&gt;full_total-&gt;prices[0]-&gt;price_value_with_tax,2);
in the file plugins/hikashoppayment/systempay/systempay.php

Please contact systempay's plugin provider so that they can fix the issue in the package they propose on their website once you test the change.

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

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

Less More

- Posts: 20
- Thank you received: 0
-
-

12 years 11 months ago [\#134460](#134460) by [Jeffq](/forum/user/28397-jeffq "View Jeffq's Profile")  Replied by *[Jeffq](/forum/user/28397-jeffq "View Jeffq's Profile")* on topic *[Rounding problem with product prices](/forum/29-payment-methods/863918-rounding-problem-with-product-prices#134460 "Hi,  On a few of my products, I'm having a price rounding problem. The saved price is not the one input by the the user.  I configured one of them at 35€ (in price with tax), but when I save, it turns into 34.99999516 (FYI, tax is 19.6)  On the front end, it does appear as 35.00€. When I proceed to checkout, it still appears as 35.00, but when I'm transferred to the payment gateway, the amount charged is 34.99.  This happens with the hikashop systempay module (French banks), and not with the paypal module.  I'm guessing the systempay module doesn't round up the price the way the paypal module does. But since the price stored in database is 34.99999516, it seems to me the problem is with the tax calculation, and not with this payment module, right? Is there anyway to force hikashop to save Exactly the price with tax input by the merchant?  It's the only problem preventing me from launching my site :)  Thanks in advance.  Regards Hikashop 2.2.2 Joomla 2.5  PS: I've posted this on an archived topic, not sure if I should have, so I created a new one... apologies for the mess")*

Hello,

As usual, awesome support ![:)](/media/kunena/emoticons/3.png ":)")
This works indeed. I'll test it a bit more before submitting this change to the plugin provider.

Regards,
Jeff

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NjM5MTgtcm91bmRpbmctcHJvYmxlbS13aXRoLXByb2R1Y3QtcHJpY2VzP3RtcGw9bWFya2Rvd24=) 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.053 seconds

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