Missing 0's from when creating an order in admin.

Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

We appear to be missing 0's from the unit price, vat amount and Payment Due when creating an order in admin. Please see the screenshot.

unit price should display like this: 1.00
VAT should display like this: 0.20
And Payment Due should display like this: 1.20

But as you see in the screenshot 

unit price displays like this: 1
VAT displays like this: 0.2
And Payment Due displays like this: 1.2

It appears to display correctly in other areas of admin.

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

How many decimals have you given the currency? See Admin -> Currencies -> Edit Currency

Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

Hi Tim I have not changed the decimals from the default 2. But if I change it to say 3, then 1.00 becomes 1.000 in the front end

Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

This only seems to be happening in create order page. I you look at the product picker screenshot it displays correctly.

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

2 decimals is good, that is the correct setting.

I will need to troubleshoot why the browser does this. Numerical input fields are handled by the browser.

Meantime, try swapping type="number" to type="text" for the currency field in func_form.inc.php.

Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

Hi Tim I tried swapping type="number" to type="text" for the currency field in func_form.inc.php but could not get that to work.

LiteCart Fan
Tól től Bulgaria
Tagság jan. 2021 óta

Value = 2 GBP

Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

Hi Vladislav. Sorry I don't understand what you mean by Value = 2 GBP. When I create a product I alway woul put for example 2.00 and that displays correctly in the front end and everywhere in the backend except order editor.

LiteCart Fan
Tól től Netherlands
Tagság dec. 2022 óta

This can be a solution. 
Current input for all the currencies looks something like this:
<input class="form-control" type="number" name="items[1][price]" value="5.35" step="any" data-type="currency">
Changing [b]step="any" [/b]to [b]step="0.01" [/b]could be a solution. 
<input class="form-control" type="number" name="items[1][price]" value="5.35" step="0.01" data-type="currency">

A better solution(in my opinion is to force 2 decimals:


function format_2_dec() {
    var curr_val = parseFloat($(this).val());
    $(this).val(curr_val.toFixed(2));
}

$('input[type="number"][data-type="currency"]').on('change', function() {
    $('input[type="number"][data-type="currency"]').each(format_2_dec);
});```
[url=https://jsfiddle.net/cnexo50k/4/]Fiddle[/url]

But as far as i can see in the backend order, this happens only when changing the Unit price or Tax. After saving it is in 2 decimals
Merchant
Tól től United Kingdom
Tagság ápr. 2023 óta

Thank you Tim. That fix works perfectly. We really appreciate you taking the time to fix on minor issues like this one.

tim
Founder
Tól től Sweden
Tagság máj. 2013 óta
tim

Wonderful to hear 🙂
Thank you

Te
Ez a weboldal nem használ cookie-kat és nem használ harmadik féltől származó nyomkövetési technológiát. Úgy gondoljuk, hogy jobban tudjuk csinálni, mint mások, és tényleg gondolunk az Ön magánéletére.