Hello,
I was developing one system plugin for showing products in Joomla article. Now the problem is when I set shop currency to "Euro" the price just showing fine but then I am changing it to "USD" prices aren't showing correctly. Here is some screen short:
euro.png: When I change shop currency to Euro it's fine.
usd.png: But USD not working. Same problem with Canadian Dollar (CAD) too :(
product_detail.png: USD working just fine in product detail page.
I am using Joomla 3.4.3 with latest VM 3.0.9
What may be the problem? Any suggestion? Thanks in advance :)
No one to help me please :( :(
Hi,
How you change currency ? With the virtuemart currencies module or changing the currency id ?
Thanks for your reply.
Quote from: Studio 42 on July 24, 2015, 16:23:27 PM
How you change currency ? With the virtuemart currencies module or changing the currency id ?
I am changing currency from back-end of virtuemart shop setting.
Hi jibon57,
Why from back-end?
Check the virtuemart curencies modules, perhaps you don't set it correctly, if you have to find how it work then look in
YOURSITE\administrator\components\com_virtuemart\helpers\currencydisplay.php.
If you don't get same currencies as in currencydisplay, then you have to use another instance.
Some sample code i needed in my case to display 2 currencies at same time:
$currency = CurrencyDisplay::getInstance (); // current currency from session
$vendorCurrency = CurrencyDisplay::getInstance ($currency->_vendorCurrency); // current default currency
of course you can use another currency_id as "_vendorCurrency", this is only how i solved my case to always get vendor currency in front fro a plugin.
Thanks for the reply but that wasn't the problem I think as I did that before you mentioned. Never mind I solved that problem already.
The problem was something very interesting. If you notice when you will use USD or CAD as your shop currency then the currency symbol & amount will be like this: $10 or $20 but if you use Australian Dollar then $ 10 or $ 20. So you will notice that one space between the symbol & amount. That was the main problem with USD as it don't have that space. When I was passing the data using my system plugin (onAfterDispatch()) that time Joomla was removing that Dollar sign ($) with the first digit of amount & that's why I was getting 0 only. If the amount $2.39 then I was getting .39 only :P ... I just did like bellow to solve the problem:
$products = str_replace("$", "$ ", $products);
& that's all :)