Adjusting currency

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version: 4.4

Question:

I want default currency symbol in currency field to be € rather than $. How do I set this?

Thanks for any help.

    private static $db = [
        'Price' => 'Currency',
    ];

    ...

    public function getCMSfields()
    {
        ...
        $fields->addFieldsToTab('Root.Main', [
            CurrencyField::create('Price'),
        );
        ...
    }

There’s a config variable in the DBCurrency class, so you should be able to set it in your YML config file:

SilverStripe\ORM\FieldType\DBCurrency:
  currency_symbol: '€'

2 Likes