News:

Looking for documentation? Take a look on our wiki

Main Menu

Display 2 currencies in product, category and cart

Started by veselinovm, September 07, 2022, 17:37:35 PM

Previous topic - Next topic

veselinovm

Hi,
I am using VM: 3.8.6 and Joomla 3.10.11

In Croatia now, because of introducing Euro,  it is mandatory by law to show both currencies in webshop.
What to change in order to show, beside vendor currency (Croatian kuna), also Euro. In Configuration it is set to be muli currency and currency modul is working, but need to be displayed in a same time both currencies.

Thank you,
Milos

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

veselinovm

Hi Pinochio,
Thank you for your answer. I did search first, but could not find suitable solution.
There is thread with swithcer, which is native solution, but I need to be dispayed both prices at the same time.
There is also solution that works only on productdisplay view, not on products.php and cart.
If you seen correct solution, please share a link.
Thank you,
Milos

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

veselinovm

Hi,
yes, similar...
Showing same price in different currency on category, productDetail and cart view.
I can make it in productDetail view with solution from : https://stackoverflow.com/questions/8826711/how-to-display-2-prices-in-different-currencies-for-an-item-invirtuemar/8836484#8836484
but in cart dont know how to make it...
in cart view, price is displayed with this code:

echo $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax', '', $prow->prices, FALSE, FALSE, 1.0, false, true);

and shows price in selected currency. How to change that line to show in "hard coded"currency (eur)?

Thank you,
Milos

Milbo

You must do this with a template override, but the rest is quite "simpel".

Just use the currency object correctly. The normal thing is

echo $currency->createPriceDiv ('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);


You see there the $currency, this is the currency object. Just create on top of the layout your own, with the croation currency.

$currencyCroatian  = CurrencyDisplay::getInstance(191, 1);
[code]

and then just use
[code]
echo $currencyCroatian  ->createPriceDiv ('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);


To display the converted price. ahh of course your store runs in croatian currency already. Then you just need to replace the 191 (id of croation currency) to 47 for the eur currency data.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

veselinovm

Excellent!
work perfectly!
Thank you very much for your help!