Hi,

Really enjoying setting up Commerce software.

I changed default store currency to AUD and put checked the AUD as the only enabled currency.

Unfortunately there are no other setting shown, like how I would like the currency displayed.

In Australia we display the price of things in exactly the same manner as they do in the USA

A price in Australia looks like:

$49.50

and never looks like anything else, always starts with a dollar sign before the price and nothing more.

How can this be achieved in Commerce?

Thankyou, really need help with this.

Regards from Josh

Comments

rszrama’s picture

We should just have to update the currency array with the proper values. See http://www.drupalcommerce.org/faq/currency-format for more info.

jlhs’s picture

Great, thanks Ryan,

Excellent job you are doing with commerce!

All the best from Josh

rszrama’s picture

Out of curiosity, what do you do in multi-currency scenarios?

jlhs’s picture

Hello Ryan,

I am building a site for an Australian watch shop. The shop is only going to be for an Australia wide market.

If the site was multi-currency and aiming for a global market, I guess I would give the USA the nicer looking single $ sign because it has more people and a bigger market and Australia I would still put the $ sign before the price (After just looks ugly). But I would have the price for Australian dollars as Au$

I have updated the array to just a dollar sign as suggested and the other key > value I grabbed from the American dollar amount array to put the price before. Thankyou.

All the best from Josh

I hope I can get my PHP chops up to scratch someday soon so I can add to this project some time. Great work!

mikejoconnor’s picture

Status: Active » Fixed

I'm going to go ahead and mark this fixed. Please re-open if you need more assistance.

essbee’s picture

Hi Josh,

I had the same issue so I just built a module that changes to the expected way of displaying. Entire module code is 1 function with 3 lines of code.
If you just create the following two fles and put in a folder called commerce_aud then enable your module you will be all good. Then when it gets fixed in the module later you can just disable and remove the module.
Cheers,
Sam

Filename: commerce_aud.module

<?php 
/**
 * Implements hook_commerce_currency_info_alter().
 *
 * Because the default display of AUD is awful
 */
function commerce_cellier_commerce_currency_info_alter(&$currencies, $langcode) {
  $currencies['AUD']['symbol'] = '$';
  $currencies['AUD']['symbol_placement'] = 'before';
  $currencies['AUD']['code_placement'] = '';
}

Filename: commerce_aud.info

name = "Commerce - AUD"
description = "Fix AUD display"
core=7.x
package = "Commerce"
files[] = commerce_aud.module
jlhs’s picture

Nice one Sam. Thanks.

That should stop having to edit files each Drupal Commerce upgrade.

All the best from Josh

rszrama’s picture

I'd definitely support a module that lets sites do custom currency formatting. I think there's an open issue for it... just a matter of getting tweaks like this one into a settings form somewhere. : D

essbee’s picture

Yeah, are you thinking something like a form with just "currency prefix" and "currency suffix" fields. That would be about the grand total of it wouldnt it?
I guess to take it further and make it multi-currency supportive you would have it read the active currencies and offer up prefix/suffix fields for each.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

husumiao-1’s picture

Thank for essbee.
I take 2 hours for it last day, and never resolved it. Because i think there is should be options settings can do that, actually i never found it. Thanks again.

silvio pontes’s picture

Assigned: Unassigned » silvio pontes
Status: Closed (fixed) » Active

Thank you essbee.
I create the folder called commerce_aud.
I create the two files called commerce_aud.module and commerce_aud.info.

I try to install this module, but is show to me error message.

To create the two files i use the N++.

Do you have tip?

Best Regards,
silvio pontes

rszrama’s picture

Status: Active » Closed (fixed)

(This is a pretty old issue, so it's best to leave it closed and either use essbee's contact form if it's enabled or seek help in the #drupal-commerce IRC channel.)

Heather51’s picture

Just for anyone whose using the code in #6 I was getting errors because I hadnt noticed that the line:

function commerce_cellier_commerce_currency_info_alter(&$currencies, $langcode)
should read :
function commerce_aud_commerce_currency_info_alter(&$currencies, $langcode)

also changed the line:

$currencies['AUD']['code_placement'] = '';

to:

$currencies['AUD']['code_placement'] = 'hidden';

The code which work for me in a module named commerce_aud as per instructions in #6 is a follows:

function commerce_aud_commerce_currency_info_alter(&$currencies, $langcode) {
$currencies['AUD']['symbol'] = '$';
$currencies['AUD']['symbol_placement'] = 'before';
$currencies['AUD']['code_placement'] = 'hidden' ;
}

Everything now perfect. Thanks for a simple fix. Would be great if these settings could be incorporated into the commerce admin ui.

shaneonabike’s picture

Wow..

I think that it would be great to have this as an option in Drupal Commerce to add the appropriate symbol? This is pretty standard regardless of adding the CAD/AUD/USD afterwards

Thoughts...

mbahlol’s picture

thanks essbee and heather51. this is what i do for my Indonesian Rp

function commerce_idr_commerce_currency_info_alter(&$currencies, $langcode) {
  $currencies['IDR']['symbol'] = 'Rp ';
  $currencies['IDR']['symbol_placement'] = 'before';
  $currencies['IDR']['code_placement'] = '';
}
relaxpor’s picture

Don't forget to clear the cache, everything work

matthijs_hofstede’s picture

For future referece, i was looking for a way to move the symbol. I found this module that does the trick:

https://drupal.org/project/commerce_currency_settings