Jump to content

Price-fields in german settings (decimal point=comma)


csaggo.com
 Share

Recommended Posts

 Hi @kongondo

as allready briefly discussed in our email-exchange:

We have PW running in german which means that in float - number fields the decimal point will be displayed as a comma (in fields as well as output rendering). The price gets stored correctly but when editing the product again, the price is not displayed and if you don't reenter it, it will be lost on save.

In First Screen you can see that PW Float Field handles this correctly (displaying comma as decimal point but still using the dot in value attribute) 

1728234441_Bildschirmfoto2022-04-26um10_38_06.thumb.png.098b90b2098e2d965a719909b26c7a20.png

In padloper price-field it uses the comma in the value attribute which the browser can't handle.
1099374913_Bildschirmfoto2022-04-26um10_41_45.thumb.png.3ee71e67b72e4cecc02eb61bfd016014.png

 

so the solution should simply be to render the value with the raw version instead the output-rendering that includes the comma.

Link to comment
Share on other sites

6 hours ago, zoeck said:

Off topic, but shouldn't the decimal field be used for a price (not float)?

Yes, but this doesn't apply to Padloper. Padloper does not use a ProcessWire field (neither FieldtypeFloat nor FieldtypeDecimal) for price. Instead, it uses a custom Fieldtype that stores price, ex-price, etc. For price, the Padloper custom field utilises a DECIMAL (12,2) sub-field/column ?

  • Like 1
Link to comment
Share on other sites

On 4/27/2022 at 7:08 PM, kongondo said:

Thanks for filing the bug report. I'll work on this and report here.

@kongondosorry to bother, but do you have an ETA on this. Its pretty crucial for us, as we can't let our customer start editing product-data as long this is not working, they will just delete prices left and right. so our project is currently waiting for this fix.

Link to comment
Share on other sites

Hi @csaggo.com,

Work on price fields to accommodate international currencies is now complete. Decimal styles are now handled correctly. In addition, thousands are also separated correctly (automatically).

To help with this, we now have a new setting in Shop / General Settings -> Standards Tab -> Currency Format (please see screenshots below). Price fields will be formatted based on this new setting. Price fields also display the currency symbol if one exists or the currency's abbreviated name. Currently, this is not configurable but I can add this in future if there is demand for it. This also works for variants price fields. Update summary:

  1. Automatic formatting of price fields based on the General Settings 'Currency Format' (currency locale). This means, e.g. Canada French versus Canada English is possible; France - thousand separator is space; Germany - thousand separator is period and comma is decimal character, etc.
  2. Thousands are automatically formatted as you type.
  3. Thousands separator is based on the 'Currency Format'.
  4. Decimal style is based on the 'Currency Format'.
  5. Currency value validation is also enforced client-side. For instance, if 'Currency Format' is 'de-DE', one cannot use a period as a decimal. Other invalid entries are also prevented, e.g. cannot enter text in this field.
  6. Automatic currency symbol placement.
  7. Currently, there are no in/decrement elements on the price field.
  8. Works with both products and variants (include variant creation modal).
  9. Not yet implemented in manual order editing (e.g. fixed discount amount, etc).

Download

Please use your download link to get the updated Padloper. If you don't have this in your email, please send me an email to resend it to you. Once downloaded, use the files to overwrite the ones in your present install. You might need to refresh your browser cache to clear the older JavaScript files.

Version

The Padloper version stays the same until #8 is resolved.

Screenshots

Currency Format (locale)

padloper_formatted_price_fields_001.thumb.png.b9bad3729a292eab99f6dc93b8d22ab9.png

Example: Canada currency formats

padloper_formatted_price_fields_002.thumb.png.f4ea26957d3a01d14974573befb6b283.png

 

Example: Germany currency format

padloper_formatted_price_fields_003.thumb.png.6d86933c77b6cde921405e6833c5edb8.png

Edit Product (German Euro is currency)

padloper_formatted_price_fields_004.thumb.png.d59fb8da7268a1f3e7cd579ce915a1cb.png

Edit Product Variant (German Euro is currency)

padloper_formatted_price_fields_005.thumb.png.2da8517985bd7738cb7bd08aeadfc6d9.png

Create Product Variant (German Euro is currency)

padloper_formatted_price_fields_006.thumb.png.66af7088a0b16f372b70c9967059af80.png

Please test and let me know how it goes.

Thanks.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

@kongondothank you for the new version

unfortunately it does not work correctly for me

- in product list it randomnly changes between showing a dot or a comma. see the two screens of list.

- in edit it still loads attribute value with a comma and now displays the price but only without decimals (see third screen)

 

Bildschirmfoto 2022-05-09 um 07.39.44.png

Bildschirmfoto 2022-05-09 um 07.39.52.png

Bildschirmfoto 2022-05-09 um 07.40.17.png

Link to comment
Share on other sites

1 hour ago, csaggo.com said:

unfortunately it does not work correctly for me

@csaggo.com,

This is very strange as it works here as intended. Could you please tell what Browser you are using? In addition, what are you currency settings? I am assuming Germany for both currency and currency locale.

Thanks.

Link to comment
Share on other sites

@kongondo
i have EUR (Austria) and for currency i tried both DE_DE and DE_AT (for Austria)

i tried latest chrome and latest firefox on macos

i would assume the root-issue is still that the value-attribute on the input field is rendered with comma as mentioned in first post, this would allready have solved the editing issue, the currency display settings for me are an additional feature. but i would take care of that where necessary in the frontend anyway. 
 

Link to comment
Share on other sites

33 minutes ago, csaggo.com said:

would assume the root-issue is still that the value-attribute on the input field is rendered with comma as mentioned in first post,

@csaggo.com This shouldn't be the case any more as we now use a plain text field. This means that you should enter your decimal as usual for your country (i.e., comma). Thousands will be automatically formatted (i.e. in your case, periods will be automatically inserted as you type to separate your thousands). As you are aware, the primary issue is that HTML input of type number does not allow commas as decimal characters. Hence, a JavaScript solution is needed as a robust solution.

33 minutes ago, csaggo.com said:

the currency display settings for me are an additional feature

Yes, this is true. However, I have to cater for 300+ international locales. In addition, I'll also need to take care of percentages (working on this now), e.g. in shipping rates. Without those symbols it can get very confusing.

I'll try a different fix and report here.

In addition, if you are developing remotely, if possible, could I have a look at your site and try and debug this? A temporary login would do. Please PM or send and email if this is possible. 

Thanks.

Link to comment
Share on other sites

On 4/26/2022 at 9:43 AM, csaggo.com said:

so the solution should simply be to render the value with the raw version instead the output-rendering that includes the comma.

This alone wouldn't work. I also need to cater for situations where the shop's currency is different from the shop editor's browser settings or location. 

https://stackoverflow.com/questions/13412204/localization-of-input-type-number

Edited by kongondo
Link to comment
Share on other sites

Happy to report that this issue has now been resolved. Thanks to @csaggo.com for the report and proposing a solution. This has now been implemented across all number HTML inputs. To upgrade, please grab the latest download.

ps: the UI has changed slightly from the screenshots I posted in earlier posts in this thread.

Thanks.

Edited by kongondo
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Jan Fromm said:

Where can I find the latest download? Thanks!

From the link that was sent to your email when you purchased Padloper. Alternatively, you can request a link from this form (and check spam box just in case). Please let me know if you need help with this.

Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...