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

Merchant
Od United Kingdom
Użytkownik od kwi 2023

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
Od Sweden
Użytkownik od maj 2013
tim

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

Merchant
Od United Kingdom
Użytkownik od kwi 2023

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
Od United Kingdom
Użytkownik od kwi 2023

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

tim
Founder
Od Sweden
Użytkownik od maj 2013
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
Od United Kingdom
Użytkownik od kwi 2023

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
Od Bulgaria
Użytkownik od sty 2021

Value = 2 GBP

Merchant
Od United Kingdom
Użytkownik od kwi 2023

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
Od Netherlands
Użytkownik od gru 2022

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
Od United Kingdom
Użytkownik od kwi 2023

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

tim
Founder
Od Sweden
Użytkownik od maj 2013
tim

Wonderful to hear 🙂
Thank you

Ty
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.