Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Currency Euro


Go to End


5 Posts   3188 Views

Avatar
biapar

Forum Moderator, 435 Posts

29 June 2009 at 8:18pm

Hi,

I've made currency Euro config, but there is an'error on currency format.

Error format: 2,000.00 EUR
Good format: 2.000,00 EUR <--- how setup this?

Avatar
chrisdarl

Community Member, 33 Posts

29 June 2009 at 11:23pm

Don't think it supports this yet.. you would have to make some adjustments to sapphire/core/model/fieldtypes/Currency.php

Maybe using a decorator / extension to keep upgrade capability

Avatar
biapar

Forum Moderator, 435 Posts

30 June 2009 at 8:50pm

How? Or is a localization problem?

in mysite/_config.php, I put:

i18n::enable();
i18n::set_default_lang('it_IT'); // for Ita
i18n::set_locale('it_IT');

Avatar
biapar

Forum Moderator, 435 Posts

30 June 2009 at 11:07pm

Now ok...

in currency.php , I've changed to

number_format(abs($this->value), 2,',','.');

from

number_format(abs($this->value), 2);

Bye

Avatar
maksfeltrin

Community Member, 6 Posts

18 July 2009 at 11:43am

In my opinion It's advisable not to modify core classes but simply to extend them eventually overriding original methods. As an example in MyPage.php:

MyPage_CurrencyEuro extends Currency
{
protected static $currencySymbol = '€';

function Nice()//or NiceEuro() if You don't want to override
{
$val = self::$currencySymbol.'&nbsp;'.number_format(abs($this->value), 2, ',', '.') ;
if($this->value < 0) return "($val)";
else return $val;
}
}

or in a separate class-file CurrencyEuro.php

CurrencyEuro extends Currency
{
protected static $currencySymbol = '€';

function Nice()
{
$val = self::$currencySymbol.'&nbsp;'.number_format(abs($this->value), 2, ',', '.') ;
if($this->value < 0) return "($val)";
else return $val;
}
}