since i am using Paypal module but mainly focus to local customers, display the price of product in HKD will let Paypal module crazy, and if display in USD will let customer confuse. so i add this option to payment.module. This patch will:

  1. if enable multiple currency, a "display only" price will show after normal, basic price
  2. exchange rate can be updated due to currency_api.module, during cron. static exchange rate is support, too
  3. both system and display currency have its own set of parameter about display format


hswong3i’s picture

11.42 KB

now come with a complete new version of this hack
detail in here (with screenshot):

now support:

  1. support for at most 5 default currncies format, with individual attributes setup.
  2. all currencies others than base currency are display only, they will not change the DB price.
  3. exchange rate can be hard code, or update by cron.
  4. module currency_api is not a must, but with it can enable the dynamic update of exchange rate, and can chose currency code by using drop down menu.
  5. handle dynamic update of exchange rate by cron and currency_api.
  6. if display currency is not equal to base currency, price will show in difference format, come with a link to payment agreement page. this link can be config within settings.
  7. admin can active only part of the currency settings. this will be useful after custom currency setup is support in coming on version.
rickvug’s picture

Thanks for posting this! At my job just told a client that we wouldn't do multiple currencies with their budget. I might just fool around with this in a few weeks and implement in a few weeks. I'll be tracking this patch and will give feedback if I try this out.


hswong3i’s picture

i am now working on create a config page for each user, which as like as address.module, so registered customer can chose what currency format they hope for. may be a block for customer to switch it, is also a good idea. i think the most ideal case is work as like as i18n module, but that may be a huge job...

any suggestion? please let me know after you try it out ;-)

hswong3i’s picture

17.02 KB

finalyl a much more useful version, detail and screenshot:

update of the perious version. add three main function: advance currency mode, custom can chose their display format, display with or without base currency.


  1. admin can chose to disable advance currency formatting. all setting will effect as like as before.
  2. will have same function as basic version if config with default setting of advance currency formatting.
  3. if display currency is not equal to base currency, price will show in difference format, come with a link to payment agreement page. this link can be config within settings. and a link to user edit page for per user configuration.
  4. admin can active only part of the currency settings. this will be useful after custom currency setup is support in coming on version.
  5. admin can chose to display with base currency or not, when display currency is not equal to base currency.
  6. anonymous user will use default configuration. registered user can have their own config.
hswong3i’s picture

Title: Add Multiple Currency Options to payment.module for Display Only » Add Advance Currency Formatting to payment.module
17.7 KB

detail in here:


  1. clean up some code in payment_format
  2. update some description, and the use of t()
  3. change the format of display both price to: (base price) » (display price)#
  4. the link after price will point to "user edit page -> currency setting" region directly. title message is add too.
hswong3i’s picture

Category: task » feature
hswong3i’s picture

BTW i am now using this patch in my site, please feel free to have a look amd give me some comment ;-)

sime’s picture

Status: Needs review » Needs work

I love what you've done with the site. I recommend this be considered by gordon or other. I am concerned firstly about everything that's been added to payment_format(), I don't seem to be any control if I want to theme the way the alternative currencies are displayed.

hswong3i’s picture

You are right that there are none of control if you want to theme the way the alternative currencies are displayed. May you provide a more detail idea about how you hope to theme it?

Style of both base price and display price? I think this can be done by using CSS (add a <div>). I can try to add a .css file for payment.module, so the style can be handle by this.

On the other hand, is that means you don't hope to have a default styling apply to price formatting? for example, using <sup> for link, <i> for display price, and event can change the » between base and display?

gordon’s picture

I like the idea of this, but I would like to see a more intergrated solution which will not just display the price but allow the user to select the currency, which will set $txn->currency = 'AUD'; or what every.

This would mean that you could use fixed prices for difference currencies, so you can set default prices. Also when this flows through to the payments the gateways that are being displayed will be only the onces that support the select currency.

This means that when the use is being charged they are being charged in there currency and not that of the site.

The only thing that I don't know about is how this will interact with a General Ledger.

I like what you have done so far, and want it for 4.8, but I want it to be a complete implementation, and not just a display method.

hswong3i’s picture

Currently user can select what currency format that they hope to use for display, within their user profile page. The exchange rate is now cached during cron. Price is now fixed to one currency format, all translation will base on this. The benfit of this implementation is clear: we keep DB format unchange. Support for difference base currency of indivdual product (take eBay auction system as example) required change of DB, and i hope to have your idea about this topic before taking any action. Since i am still new to E-Commerce project ;-)

Here is a question: if we charge user in their local currency, then we will also need to save the exchange rate during transaction. Else during accounting, we will use the current exchange rate, which may be difference (and this is usual) from time of transaction, and the book will then not balance.

On the other hand, if we input all transaction currency to bank (with change to our accounting currency) whenever we recieve the payment from client, we don't need to have support of multiple base currency format. But surly can't support system as like as eBay :(

I didn't intergrated all we need but only display method, since this is a hunge topic. I think before we take action for such redesign of framework, we better collect for more difference voices. Specially from professional of General Ledger system. I post a story within group and hope can collect for more idea:

hswong3i’s picture

3.51 KB

I take osCommerce as reference and found that:

  1. osCommerce only support one base currency format
  2. a block can let every customer to change currency format on the fly
  3. only need to display one currency format at once

I clone the implementation of multiple currency handling osCommerce to drupal E-commerce module, and build a module call "ecurrency". Target of this module:

  1. allow admin to add new currency, with no maximum limit
  2. no more automatic update of exchange rate by cron. beside that now each exchange rate can be update by clicking the link "update"
  3. a block which let every customer to change their currency format (not yet done)
  4. printing of formatted price (not yet done, will clone from old implementation). require hack to payment.module so can by pass the default printing method

here is the online demo of current work:

sime’s picture

Component: payment.module » payment
Status: Needs work » Closed (fixed)

ec_currency is in CVS