Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When switching from the default dollar sign to euro, the € sign is displayed behind the price instead of in front of it.
So "100.00 €" should be "€ 100.00"
Comment | File | Size | Author |
---|---|---|---|
#26 | commerce_euro_sign-7.x-1.x.tar_.gz | 381 bytes | Stan Turyn |
Comments
Comment #1
pcambraIt seems that depending on the country/language, € symbol goes before amount or after amount:
http://evertype.com/standards/euro/formats.html
Comment #2
Argus CreditAttribution: Argus commentedOk, then the display should follow regional settings in admin/config/regional/settings
Currently it doesn't seem to do so (checked after clearing cache).
Comment #3
pcambraHi, not sure if we want to take care of every case depending on language/country, as workaround you can use hook_commerce_currency_info_alter to alter the 'symbol_pacement' property.
Comment #4
pcambraI was thinking on this, maybe we could add a rule action to change the properties of the currency on "calculating the sell price of a product"
https://skitch.com/pcambra/rck2b/editing-reaction-rule-currency-symbol-d...
Comment #5
rszrama CreditAttribution: rszrama commentedHmm, I don't think using that event is a good way to do this, as it's really just a formatting issue and not a price calculation issue. Other than using the hook pcambra recommends, though, I'm not sure we'll get a decent solution to this in core. I could see space for a contributed module providing a UI for currency formatting based on language, though.
fwiw, the current formatting is based on France's use, but even in France it's going to be different from locale to locale (i.e. 100,00 € vs. 100€00).
Comment #6
rszrama CreditAttribution: rszrama commentedWhoops, noticed the version was still alpha5. I'm marking this postponed as it's really a problem for contrib to solve.
Comment #7
Argus CreditAttribution: Argus commentedPerhaps there is a way using the "Rewrite the output of this field" function in Views work to solve this? Can't get it to work using the currently available tokens:
[entity_id] == Fields: commerce_price
[entity_id-amount] == Raw amount
[entity_id-currency_code] == Raw currency_code
[entity_id-data] == Raw data
Comment #8
rszrama CreditAttribution: rszrama commentedThat would work for Views field displays, but that operates outside of normal field rendering. I think what will end up needing to happen is just a contrib module that lets you build currency alterations for the various formatting properties of the different currencies. I suppose a token based approach could work as well in conjunction with a custom format_callback.
Comment #9
GiorgosKisn't this issue solved by implementing as per commerce.api.php
in your own module ?
Comment #10
rszrama CreditAttribution: rszrama commentedYeah, but I think the idea behind this issue is to actually have a module that lets you fiddle with the formatting via the UI.
Comment #11
Argus CreditAttribution: Argus commentedCorrect, 1) for the not so coding savvy and 2) because it is easier with less chance of less optimal code.
Comment #12
drupal@guusvandewal.nl CreditAttribution: drupal@guusvandewal.nl commented@GirogosK
Hi, for me it should be symbol_placement. Thanks for putting me on the right track.
In my template.php
Grtz,
Gus
Comment #13
george esper CreditAttribution: george esper commentedThis should be a general internationalization/localization issue.
Here in Canada, when displaying prices in English, we format as: $1,234.00.
Whereas, in French, we would format as: 1 234,00$.
Both use CAD as the currency code, but the location of the currency symbol is different. The thousandth and decimal separators are also different.
Price fields should be of type "Currency" or something similar, with formatting done according to regional settings.
Comment #14
Argus CreditAttribution: Argus commentedAgreed. One would expect currency formatting to follow the general internationalization/localization settings in Drupal. In that case a multi-language commerce site would have the currency settings correct for each language.
Currency formatting search on D.O
Comment #15
Xanoamateescu and I want to tackle this problem in the next version of http://drupal.org/project/currency, so other modules can use proper currency formatting as well.
Comment #16
silkogelman CreditAttribution: silkogelman commentedSounds like a great plan.
For those that need to put the € sign before the price today there is this little sandbox module:
http://drupal.org/sandbox/s1l/1512162
(it does the hook_commerce_currency_info_alter mentioned in #9 and #12)
Comment #17
Argus CreditAttribution: Argus commentedThanks people!
Comment #18
Summit CreditAttribution: Summit commentedHi, I tried the module from #16, but no go...my prices keep being 12,45 € instead of € 12, 45.
Could it be the problem I have selected "formatted amount" price formatter?
Greetings, Martijn
Comment #19
Summit CreditAttribution: Summit commentedHi,
Sorry but the only thing that worked was hacking commerce by changing:
Greetings, Martijn
Comment #20
fredklopper CreditAttribution: fredklopper commentedHi Martijn,
A custom module is working for me:
Mention the extra spacer after the € symbol.
Greetings, Fred
Comment #21
Summit CreditAttribution: Summit commentedHi Fred,
I did as your custom module, but now not the eurosign, but EUR is shown in front?
What could be wrong?
EDIT: I got this: EUR 17,45 €
With this code:
/**
* Implements commerce_currency_info_alter().
*/
function commerce_netherlands_currencydisplay_commerce_currency_info_alter(&$currencies, $langcode) {
$currencies['EUR']['code_placement'] = 'before';
$currencies['EUR']['symbol'] = '€ ';
}
The symbol is not placed in front..and EUR is in front..
greetings, Martijn
Comment #22
Summit CreditAttribution: Summit commentedHI,
I got it! This was the necessary code:
Greetings,
Martijn
Comment #23
fredklopper CreditAttribution: fredklopper commentedNice!
Comment #24
jhutchtor CreditAttribution: jhutchtor commentedI tried this and no luck. My prices are still display with 10,00 €. I need them to be €10.00 this is the way it people in Ireland expect the price to be and if this doesn't work - as far as I'm concerned this module is completely useless - and I will go back to Ubercart.
Comment #25
Stan Turyn CreditAttribution: Stan Turyn commentedYou have a very straightforward and working solution provided by Martijn in #22 and yet, of course, it is the module that is useless, it has nothing to do with you ;)
Comment #26
Stan Turyn CreditAttribution: Stan Turyn commentedAnyway, for someone looking for this in the future and struggling, a simple module, using Martijn's #22, is attached.
Comment #27
firfin CreditAttribution: firfin commentedthanks and bonus comedy award to Stan :-)
Comment #28
rszrama CreditAttribution: rszrama commentedHmm, my hunch is he didn't clear the cache. Gotta clear it so the hook gets noticed and the currency info array gets reset.
Comment #29
mrfelton CreditAttribution: mrfelton commentedThere was talk about adding this to the Currency module back in April. Looks like this has not happened. I'm actually thinking about adding this feature to Locale Currency (which I'm just about to port to D7). This would allow you to associate a currency and currency format options with individual locals.
Comment #30
jhutchtor CreditAttribution: jhutchtor commentedNo your answer is useless and if I want to hear from an ass I will fart
Comment #31
nevets CreditAttribution: nevets commentedThat comment is really uncalled for.
Comment #32
pcambra@jhutchtor please review drupal code of conduct and think twice before posting a comment like #30 in the future
Comment #33
James A CreditAttribution: James A commentedHi mrfelton,
Did you integrate this fix into Local Currency? I had a quick look at the code, with my limited knowledge, but didn't see anything tying it into the hooks referred to above.
If you haven't it would seem to be the most suitable way to do things as then the format simply depends on the individuals PC settings.
Comment #34
mrfelton CreditAttribution: mrfelton commented@James A - No, didn't get around to this yet. Just using a custom implementation of the hook for our needs for now. Would be nice to see this added to Locale Currency though.
Comment #35
Connie Chen CreditAttribution: Connie Chen commentedHas this issue (currency location issue) been resolved in Commerce Kickstart 2.0? In Hong Kong, we also write $ 10.00 or HK$ 10.00, and never 10.00 HKD.
Comment #36
rszrama CreditAttribution: rszrama commented@Connie Chen - all you need to do is open an issue with the proper format for your currency and we'll get it fixed; please refer to http://www.drupalcommerce.org/faq/currency-format for more information.
Comment #37
Connie Chen CreditAttribution: Connie Chen commented@rszrama - thanks for the suggestion. I have opened an issue here: http://drupal.org/node/1799638
Comment #38
feddovdm CreditAttribution: feddovdm commenteddon't forget to re-save the 'currency-settings', this did the trick for me.
admin/commerce/config/currency -> save again.
Comment #39
Jawi CreditAttribution: Jawi commented#26
The module of #26 gives an error message when putting the files in the module folder:
Warning: file_get_contents(sites/all/modules/commerce_euro_sign/commerce_euro_sign.info
Comment #40
Stan Turyn CreditAttribution: Stan Turyn commentedJawi,
Check file permissions on that folder and files and make sure the web server can read the files and read/execute on the directory.
Comment #41
Argus CreditAttribution: Argus commentedcurrency_commerce may have tackled this problem.
Comment #42
XanoThe core issue is that Commerce can only change the formatting per currency, which is flexible enough for most webshops (as they only serve a single country), but which is conceptually wrong. Price formatting depends on the locale (country and language) the reader is in. Currency's aim is to provide locale-based currency formatting. Currency for Drupal Commerce was built to format all prices in Commerce using Currency's locale-based formatting.
Comment #43
Argus CreditAttribution: Argus commentedThen let's close this issue. Check Current for Drupal Commerce for the best currency formatting solution.
Comment #44
rszrama CreditAttribution: rszrama commentedActually, let's leave this open. That module is basically replacing the currency system by integrating with another contrib module, not just providing a way to configure currency formatting per locale within the existing system.
Comment #45
XanoThat is absolutely correct. Do note that Commerce's currency handling currently serves the 80%, and that 'doing it right' requires quite some insight and extra code to deal with the Unicode CLDR number patterns and different locales. It's not something that is easily replicated (e.g. without adding extra bulk).
Comment #46
pcambraPointing to => http://drupal.org/project/commerce_currency_settings
Comment #47
martin74 CreditAttribution: martin74 commented@Stan Shevchuk and Martijn
Thank you!
Comment #48
jibize CreditAttribution: jibize commentedI am not sure this is the right place/issue to post this (forgive me if it's not), but I created a module that provide a way to display formatted prices according to locale information: https://drupal.org/node/2037573, which hopefully could also fixes issues that people are having here.
I am not sure this is the "right" way to do it, but maybe some more experienced developers than me could have a look at it and provide some feedbacks?
Thank you!
Comment #49
roball CreditAttribution: roball commentedAs mentioned in #46, the Commerce Currency Settings module does handle that perfectly, doesn't it?
Comment #50
Argus CreditAttribution: Argus commentedYes, I think is does.