News:

Looking for documentation? Take a look on our wiki

Main Menu

Show price in two currencies

Started by mratki, August 10, 2022, 11:16:10 AM

Previous topic - Next topic

Jumbo!

Have you defined/replaced the $price variable?

mratki

Quote from: Jumbo! on August 31, 2022, 16:51:59 PM
Have you defined/replaced the $price variable?

I didn't think about it at all, my php knowledge is awfull, can you help me with the variable definition?

Regards,
Mateo

Milbo

Quote from: Jumbo! on August 10, 2022, 18:04:21 PM
You can use the following codes to display the prices in Euro. It will also work on the checkout page and orders.

<?php
$euroCurrencyId 
47;
$vendorId       1;
$currencyEur    CurrencyDisplay::getInstance($euroCurrencyId$vendorId);

echo 
$currencyEur->priceDisplay($price$euroCurrencyId);
?>


Quote from: Jumbo! on August 10, 2022, 20:39:14 PM
Quote from: pinochico on August 10, 2022, 18:15:03 PM
Jumbo,

I don't think so.

Why is so complicated?

In sublayout price is only one line and on one place.

That's because if you simply use the sub-layout without creating a new instance of CurrencyDisplay with the correct currency, it will not get the correct Exchange Rate.

Test it yourself, and you will understand.

Absolutly right. You need one currency instance per currency. So if you want to display 2 currencies at the same time, you need to create two instances.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/