web design, England, Britain, UK, belgium
 

Change the VirtueMart Currency Symbols for Multi-Currency - Joomla & VirtueMart Tips & How To's

How to change the VirtueMart Currency Symbols for a Multi-Currency Shop.

Home Joomla VirtueMart Tips Change the VirtueMart Currency Symbols for Multi-Currency

Thu

03

Dec

Change the VirtueMart Currency Symbols for Multi-Currency
  • Joomla 1.5
  • VirtueMart 1.1

The VirtueMart default currency symbol is configured in the Admin-->Store-->Edit Store-->Currency Display Style but in a multi-currency Shop you just have the default currency symbols like EUR and USD for the other currencies.
I found this hack to solve this in the VirtueMart forums.



Change the default VirtueMart Currency Symbols for Multi-Currency Open the file administrator/components/com_virtuemart/classes/currency/class_currency_display.php and go to around line 122. It is the getFullValue function and looks like this..
 
function getFullValue($nb, $decimals='', $symbol = '') {
    global $vendor_currency;
    $res = "";
    if( $symbol != ''  ) {
      $old_symbol = $this->symbol;
      $this->symbol = $symbol;
    }
 
    // Currency symbol position
 
We need to add a new function called resetSymbol and call it after the getFullValue.
So change the code to look like...
 
  //Change currency symbol
 
  function resetSymbol()
  {
           switch($GLOBALS['product_currency'])
          {
                  case 'USD': $this->symbol='$';break;
                  case 'EUR': $this->symbol='€ ';break;
                  case 'GBP': $this->symbol='£ ';break;
 
          }
  }
  function getFullValue($nb, $decimals='', $symbol = '') {
    global $vendor_currency;
    $res = "";
    if( $symbol != ''  ) {
      $old_symbol = $this->symbol;
      $this->symbol = $symbol;
    }
 
   $this->resetSymbol(); //Call the change currency symbol function
    // Currency symbol position
 

You can add further cases for further currencies. Thanks to Erik P for this code.
Looks much better!

Changed VirtueMart Currency Symbols for Multi-Currency
Last Updated on Thursday, 03 December 2009 09:49
 
VirtueMart
Your Cart is currently empty.

Latest Joomla & VirtueMart Tips

See all tips & examples



Change the VirtueMart Currency Symbols for Multi-Currency|Joomla & VirtueMart Tips & How To's



How to change the VirtueMart Currency Symbols for a Multi-Currency Shop.


symbol, currency, function, virtuemart, getfullvalue, like, change, resetsymbol, break, case, looks, default, add, decimals, global, old, res, vendor, store, code, usd, eur, display, currencies, position, thanks, cases, look, euro, gbp, globals, erik, product, switch, better, called, php, multi, shop, symbols

|

We use cookies to improve our website and your experience when using it. Cookies used for the essential operation of the site have already been set.
To find out more about the cookies we use and how to delete them, see our privacy policy.

I accept cookies from this site.