This module works great. But for a website we need to display and edit all the amounts in millions. Filling in 6+ zero's gives user typo's.
Any recommendations on best practice? I think the best way is to ask users to input the amount in millions and add in function theme_money_field 'million' when displaying the field?

Comments

hanno’s picture

if you want to change sitewide the unit of the money in millions (or billions/thousands), the following worked perfect for us.

We added the following code in our template.php, for overriding the theme for the money field, where the amount is followed bij 'million'
It even works in the money converter.
Please note, that it only works if you use money field site wide for millions.

function YOURTHEME_money_field($amount, $currency, $display_options, $separator = "\xC2\xA0") {
  $output = '';
  foreach (explode('|', $display_options) as $option) {
    switch ($option) {
      case 'a':
        // The amount.
        $output .= $amount . ' ' .t('million');
        break;
      case 's':
        // Currency symbol.
        $currency_symbols = currency_api_get_symbols();
        if (isset($currency_symbols[$currency])) {
          $output .= $currency_symbols[$currency];
          break;
        }
        // Fall back to currency code.
      case 'c':
        // Currency code.
        $output .= $currency;
        break;
      case '+':
        // Separator.
        $output .= $separator;
        break;
    }
  }
  return $output;
}
kenorb’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.