ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Custom field decimal with comma

May 01, 2012 3:13am

Subscribe [3]
  • #1 / May 01, 2012 3:13am

    Mbruijn

    12 posts

    Hello,

    I want to add a custom field for a price. However EE wants me to use a dot as a decimal separator instead of the comma in Euro prices. I’ve found some other topics, but neither of them is solved.
    Is it already possible to change the dot to a comma? Or is there a way to work around this? I really need a comma, because it’s the common way to enter prices in Europe, my site visitor won’t get it if they get an error because they typed a comma.

    The field needs the have a value with 2 decimals and needs to be sorted asc/desc.

    Thanks

  • #2 / May 01, 2012 3:53pm

    Dan Decker

    7338 posts

    Hi Mbruijn,

    Let’s see if we can get you sorted out here!

    I appreciate your frustration on this, and I tried a few things to get around this. The only thing I found was a fiedtype add-on for currencies.

    I don’t see why we aren’t accounting for this already, it sounds worthy of a Feature Request.

    Is there anything else I can assist you with?

    Cheers,

  • #3 / May 02, 2012 2:10pm

    Mbruijn

    12 posts

    Hi Dan,

    Thank you for your reply. I’ve already stumbled upon the currency add-on, but I think it will not solve the problem. It handles converting currencies and has some possebilities to style the way the value is shown (€ in front or behind, etc). As far as I can see on their website it also uses a dot instead of a comma.
    I think this ‘problem’ also has to do with the way the MySQL DB handles integers/numbers. MySQL also uses dots as default. I think EE has to modify this output somehow. Correct me if I’m wrong.

    Isn’t there a way to solve this with PHP in the template and/or safecracker form?

  • #4 / May 02, 2012 6:13pm

    Dan Decker

    7338 posts

    Hi Mbruijn,

    The only way I can think around this issue is to make it an “anything goes” text input, rather than a number field.

    I tested in the Control Panel publish form, and the validation occurs in the browser, before the form submits.

    I think this ‘problem’ also has to do with the way the MySQL DB handles integers/numbers.

    I would agree, but ExpressionEngine makes all fields in MySQL “text” for channel field purposes, so technically MySQL shouldn’t care. It’s ExpressionEngine that is trying to validate the data before hand.

    Can you tell me the settings you have for this field?

    Cheers,

  • #5 / May 04, 2012 2:20am

    Mbruijn

    12 posts

    Hi Dan,

    The settings for the pricefield are:

    Type: textinput
    Formatting: none
    Fieldcontent: decimal

    I just bought CartThrob and there’s an option in the CP to adjust the prices with decimalseparator, decimalprecision, thousandsseparator, currency prefix, decimals rounding. I don’t now yet in what kind of format CT saves the data from pricefields.

    Because I’ve found an earlier request from 2010, I’ve replied to that one to bump it.

    Thanks.

  • #6 / May 07, 2012 3:33pm

    Dan Decker

    7338 posts

    Hi Mbruijn,

    Excellent. Since CT is engineered to be international, I suspect you will find the flexibility you are looking for.

    In the meantime, is there anything else I can assist you with?

    Cheers,

  • #7 / Jul 13, 2012 4:16am

    Heiko

    135 posts

    I just found this price plugin while searching for a solution to the same problem. Works like a charm!

    Just put your price field into the tag like this:

    {exp:price_format price="{price}"}
  • #8 / Jul 16, 2012 10:55am

    Shane Eckert

    7174 posts

    Hey there Heiko,

    Thanks for the tip and the link!

    If you guys need anything else, please let us know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases