Hi,
This might be useful for anyone who wants (or who has a client, who demands ;) ) decimal places in cart products setting in admin panel, so that, for instance, pp_price field formats "15.00" instead of "15". I have to say it looks way more readable for any price or value setting.

Code: Select all
<cms:config_form_view>        
   <cms:script>
      const priceField = document.querySelector('#f_pp_price');
      let ppValue = priceField.value;
      priceField.value = parseFloat(ppValue).toFixed(2)
   </cms:script>
</cms:config_form_view>

In case you have other fields (like in my current order listing template), you can stylize them all this way, eg. my custom fields are:
Code: Select all
<cms:editable type="text" name="subtotal" />
<cms:editable type="text" name="discount" />
<cms:editable type="text" name="tax" />
<cms:editable type="text" name="total" />

And the script converting them to decimal is:
Code: Select all
<cms:script>
    const priceFields = [
            document.querySelector('#f_subtotal'),
            document.querySelector('#f_discount'),
            document.querySelector('#f_tax'),
            document.querySelector('#f_total')
        ];
    priceFields.forEach(fld => {
        let ppValue = fld.value;
        fld.value = parseFloat(ppValue).toFixed(2)
    });
</cms:script>

decimals.png
decimals.png (18.9 KiB) Viewed 2007 times

I hope it helps someone :)
Best regards,
Peter