- Posts: 62
- Thank you received: 1
Round Price
-- HikaShop version -- : HikaShop Business: 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.32
Hi
Is it possible to round the Price after a coupon, payment fee, etc. for example from 20.03 CHF to 20.05 CHF?
Thanks in advance
florcar
Please Log in or Create an account to join the conversation.
Yes. Edit your currency via the menu System>Currencies and change the "Rounding increment" option to 0.05 and the system will round the elements by steps of 5 cents.
Please Log in or Create an account to join the conversation.
Thanks for the answer. I changed it to 0.05 in the options of swiss franc. But unfortunately nothing happened. It still shows the price for example:
Product Price: 39.8 CHF
voucher: 10% = 3.98 CHF
Price=35.92 CHF
regards
florcar
Please Log in or Create an account to join the conversation.
Please make sure that you have the "round prices during calculations" option turned on in the HikaShop configuration.
Please Log in or Create an account to join the conversation.
If you mean in the main configuration under taxes, it is turned on.
Please Log in or Create an account to join the conversation.
I would really appreciate you could help me with this.
Let me know if you need a login.
Regards
Florian
Please Log in or Create an account to join the conversation.
I dont want to stress anybody. I know you have a lot of requests and the support is free and by the way awesome.
But this rounding Problem is a big issue on my site. So I would really appreciate any help
Regards
florcar
Please Log in or Create an account to join the conversation.
Maybe the pictures in the attachement will show my problem more clear.
Regards
florcar
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Sorry for the delay. Such calculations issue is quite complex to debug so it took quite some time to debug, analyze and fix, and the French JoomlaDay was also in the middle...
Here is a zip with two files with the several fixes that were needed to fix that.
You'll need to replace them in the folder administrator/components/com_hikashop/classes/
Please make a backup of the original files in case there is a problem as these are complex changes and even though I did test them, it doesn't mean that I was able to cover all the edge cases.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
Thanks a lot for the solution and the efforts. And dont worry for the delay.
I replaced the attached files and it seems to work for the discounts. But unfortunately it has no effect on the payment fees. See attached Image.
Regards
Please Log in or Create an account to join the conversation.
Ah yes, here are the files to put in the same folder to fix it for the payment fees.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.
The problem still exists on the listing of the final price. The payment fee is correctly rounded in the "Choose the payment method" but unfortunately not at the final price :blush:
See attached image.
Regards
florcar
Please Log in or Create an account to join the conversation.
Mmmm. I don't have the issue on my end.
Try to change the line:
$paymentData->payment_price = ($price_all * (float)@$paymentData->payment_params->payment_percentage / 100) + $paymentData->payment_price;
to:
$paymentData->payment_price = $currencyClass->_round(($price_all * (float)@$paymentData->payment_params->payment_percentage / 100) + $paymentData->payment_price,$currencyClass->getRounding($currency,true));;
in the file components/com_hikashop/controllers/checkout.php and see if that helps.
Please Log in or Create an account to join the conversation.
No, it didnt change anything :blush:
I think you have one semicolon too much in your code. I tried both but it didnt work anyways.
Regards
Please Log in or Create an account to join the conversation.
Try like this instead:
$paymentData->payment_price = $currencyClass->_round(($price_all * (float)@$paymentData->payment_params->payment_percentage / 100) + $paymentData->payment_price,$currencyClass->getRounding(hikashop_getCurrency(),true));
If that still doesn't help, please provide a FTP access to your website via our contact form with a link to this thread so that we can directly look at the problem because we're shooting in the dark like that.
Please Log in or Create an account to join the conversation.
Now it seems to work
Thank you for your great support.
Regards
Please Log in or Create an account to join the conversation.