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.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Where to change currency from $ (dollar) prefix in ecommerce module


Go to End


3 Posts   76282 Views

Avatar
hm2k

Community Member, 7 Posts

16 April 2008 at 7:55am

In the ecommerce module, where/how do i change the currency prefix from the $ symbol?

In fact I found it was here:

sapphire/core/model/fieldtypes/Currency.php

I removed all evidence of the dollar sign, as we have the GBP suffix anyway.

I changed mine to say this:

<code>
<?php
/**
* Currency value.
* Currency the currency class only supports single currencies.
*/
class Currency extends Decimal {

function Nice() {
// return "<span title=\"$this->value\">" . number_format($this->value, 2) . '</span>';
return number_format($this->value, 2);
}

function Whole() {
return number_format($this->value, 0);
}

function setValue($value) {
$this->value = ereg_replace('[^0-9.]+','', $value);
}
}

?>
</code>

Avatar
stooni

Community Member, 89 Posts

17 April 2008 at 10:05am

Edited: 17/04/2008 10:05am

Thanks you are the very best i have search these Solution perhaps in the Checkout Page i have always a $ Sign

=========================

Please note: Your goods will not be dispatched until we receive your payment.
Amount$30.00 sFr.
=========================

how can delete that?

Thanks Stooni-----------

Avatar
JonathanParker

Community Member, 37 Posts

20 April 2008 at 8:14am

find the 'Currency.php' file in the 'saphire/core/model/fieldtypes' folder:
Here you can see where I have replaced the '$' symbol with the GBP '£' symbol.

class Currency extends Decimal {

function Nice() {
// return "<span title=\"$this->value\">$" . number_format($this->value, 2) . '</span>';
return '&pound;' . number_format($this->value, 2);
}

function Whole() {
return '&pound;' . number_format($this->value, 0);
}

function setValue($value) {
$this->value = ereg_replace('[^0-9.]+','', $value);
}
}

Save the file & do your flush=1 etc and that should be it

Jonathan