neodev Service Provider Frá Netherlands Meðlimur síðan des. 2023 neodev 5 ágú. 2024 13:52 Updating pricing using the tax-inclusive field leads to weird rounding issues. Here's how to reproduce: [ol] [li]Open a product from the catalog and go to the "Prices" tab.[/li] [li]Adjust the value in the right box on the bottom, the price including taxes field, change it to "23".[/li] [li]Save the product.[/li] [li]Navigate back to the same product using the catalog, open the "Prices" tab.[/li] [li]Notice how the prices listed are different from what was entered in step 2.[/li] [/ol] Here's what I would expect: [ul] [li]The values entered in step 2 remain the same in step 5, there's no change in the numbers.[/li] [/ul] Here's some potentially relevant webshop configuration: [ul] [li]Prices in EUR.[/li] [li]Taxes always displayed.[/li] [li]No relevant errors in the error log.[/li] [li]Table 'lc_products_prices' has collation 'utf8mb3_general_ci'.[/li] [/ul]
neodev Service Provider Frá Netherlands Meðlimur síðan des. 2023 neodev 5 ágú. 2024 19:21 Thanks alins for the workaround! The problem is that the numbers change between saving and editing again later, which to me seems to indicate there's a discrepancy between the javascript calculations and the backend calculations. I have the suspicion that decimal point accuracy also plays a role here. Doing the calculations manually is indeed an option to work around this, but why offer the field if it doesn't work? Either the form input should work as intended and allow bi-directional input without rounding issues in the different implementations, or it should be read-only as an information display only. That way, people can't make the mistake of setting a product price to a certain amount, and it then changing without their knowledge.
neodev Service Provider Frá Netherlands Meðlimur síðan des. 2023 neodev 7 ágú. 2024 15:29 Hi alins, The currency is set to EUR, with 2 decimals, EUR is set as default currency. In the Litecart settings, it is configured that prices are displayed including tax. The rounding is activated. If I deactivate the rounding, I can still reproduce the problem using the steps I described in my original report. Again, I would like to stress the problem is not the rounding itself. My problem is the system changing product prices on me after I've set a price for a product without informing me. The rounding happens after I've pressed save and have been redirected to a different webpage, leaving me with a product price that has been changed without my consent/knowledge.
alins Designer Frá Turkey Meðlimur síðan apr. 2019 alins 7 ágú. 2024 16:41 take a look at other posts on this topic in the forum. Maybe you will find some explanations that will help you more. English is not native language.
tim Founder Frá Sweden Meðlimur síðan maí 2013 tim 8 ágú. 2024 13:14 This could be a floating point precision problem but I think it's more likely the reinserted input being rounded to 2 decimals when loading the page. See if removing this line solves the problem: https://github.com/litecart/litecart/blob/d16cdda55398b933b8dca8db190d56f144f4b324/public_html/includes/functions/func_form.inc.php#L129
neodev Service Provider Frá Netherlands Meðlimur síðan des. 2023 neodev 15 ágú. 2024 11:57 Hi Tim, Sorry for not getting back to you sooner. I just tested commenting out the line and this seems to fix the issue. Now when I edit prices in the backend and re-open the same page, the prices are the same. The prices in the frontend are now also correct and as I expect them. Should I create a vMod for this for myself or will you fix it upstream? I'm not sure if commenting out this line breaks other functionality if you were to include it upstream.
tim Founder Frá Sweden Meðlimur síðan maí 2013 tim 15 ágú. 2024 12:35 Thank you for reporting back. Glad to hear this solved your problem. I have added a fix for the next release.