News:

Support the VirtueMart project and become a member

Main Menu

How to Show Currency Name/Label?

Started by Gab, September 10, 2012, 19:12:40 PM

Previous topic - Next topic

Gab

Hi. I am using Virtuemart only as a catalog, no shopping cart. I have products in both US Dollars and Mexican Pesos. My shop is set to use Mexican Pesos, but I want to display the original price, wether it's USD or Pesos.

I changed the exchange rate for USD to 1 so the price is not converted to Pesos.

My question is, is there a way to add a line below the price where it says the currency of that product?

Example for products in USD: "Price in US Dollars" or "Price in USD".
And the same for products in Pesos: "Price in Mexican Pesos".

Thanks!

ivus

Hi Gab,

add this code to your template file "/components/com_virtuemart/views/productdetails/tmpl/default_showprices.php"

at the top after "defined('_JEXEC') or die('Restricted access');"



defined('_JEXEC') or die('Restricted access');

$currency_model = VmModel::getModel('currency');
$displayCurrency = $currency_model->getCurrency( $this->product->product_currency );



add this code where you want to output the currency



echo $displayCurrency->currency_name;
echo $displayCurrency->currency_code_3;
echo $displayCurrency->currency_symbol;



$displayCurrency->currency_name => United States Dollar
$displayCurrency->currency_code_3 => USD
$displayCurrency->currency_symbol => $

It should automatically switch based on the current CURRENCY selected.

jillymot

Was just wondering whether it would be possible to enable the 3 letter currency code to display by changing the settings in the Currency Details screen?

e.g. The 'Positive Format' field in the Currency Details screen is currently:

{symbol}{number}

What term would you need to add to also display the USD/AUD/etc. 'Code 3 letters' field as part of this string?

e.g.
AUD$20.00  or  $20.00 AUD

I would appreciate your help.