Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Where to change currency from $ (dollar) prefix in ecommerce module

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

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

Page: 1
Go to End
Author Topic: 75042 Views
  • hm2k
    Avatar
    Community Member
    7 Posts

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

    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>

  • stooni
    Avatar
    Community Member
    89 Posts

    Re: Where to change currency from $ (dollar) prefix in ecommerce module Link to this post

    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-----------

  • JonathanParker
    Avatar
    Community Member
    37 Posts

    Re: Where to change currency from $ (dollar) prefix in ecommerce module Link to this post

    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

    75042 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.