News:

Looking for documentation? Take a look on our wiki

Main Menu

Currency conversion yet again

Started by virtuenewbee, January 23, 2014, 14:40:13 PM

Previous topic - Next topic

virtuenewbee

Hi,
When I just started with VM met the currency conversion confusion problem and a gentlemen from forum kindly helped me here in this post:
http://forum.virtuemart.net/index.php?topic=121106.new;topicseen#new

By then I thought I got the point and all is working fine but it was not!

In fact, I followed these steps which are slightly different than his suggested steps:
1) Enter Shop-->shop-> available currencies . Choose hrv in Currency. List of accepted currencies: dollars and hrv.
2) put price in dollars for product
3) go to Configuration in Virtuemart menu, then Currencies
4) find dollars set Exchange Rate to 0.12 (it is this, by google rate search)
5) find hrv set Exchange Rate to 0.00

In this case, I get the price nearly with correct conversion, but some +/- 6 units error.

Now to get rid of the error, I got back to that post and this time performed exactly by his steps:
1) Enter Shop-->shop-> available currencies . Choose hrv in Currency. List of accepted currencies: dollars and hrv.
2) put price in dollars for product
3) go to Configuration in Virtuemart menu, then Currencies
4) find dollars set Exchange Rate to 1
5) find hrv set Exchange Rate to 8.3

And the results are yet more confusing me:
1. the item price is set in dollar and equal to 164$
2. when I finish the above steps, save and refresh teh item page, I see 164 UAH, which means no conversion happened and it is showing just the dollor field content but with wrong unit name!

So, could anyone please let me know what is happening or what I'm doing wrong there?

Thank you,

virtuenewbee

To add to this problem description:

I just tried to change the Ukrainian hryvnia rate, I put 0, saved and refresh, no change in conversion! I then changed it to 8.3, save, refresh: no effect!

The only conclusion I can make by my level of knowledge is that "if we choose the shop currency as UAH, having the shop item in USD, then the exchange rate that affects the conversion is only what we put for USD, the UAH plays no role there".

Is this right or wrong please? Any way to be able to specify exactly which way we want the conversion to happen and not have it working only one way?

jenkinhill

The European Central Bank does not have a reference rate for UAH. The currency conversions available are in http://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html  - all rates are relative to the Euro.  So in VM I guess the default conversion rate will be 1.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

virtuenewbee

Quote from: jenkinhill on January 23, 2014, 16:54:28 PM
The European Central Bank does not have a reference rate for UAH. The currency conversions available are in http://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html  - all rates are relative to the Euro.  So in VM I guess the default conversion rate will be 1.

Thank you for helping. I'm still not sure I understand you
My problem is that my frontend currency is hryvnia and backend is dollar, and I want to set conversion rate for hrivnya, but virtuemart do not act when I set it. I use the conversion rate given internally by Ukraine bank (~8.3). Virtuemart works fine only if I set the dollar to 0.12 and it won't consider what exchange rate is chosen for hryvnia at all. That means that I can go to hryvnia and change it to 1, to 0, but prices in frontend stay the same, while dollar conversion rate is fixed. I think something is wrong with this. Logically, I think, that if there we have multiple currencies, the one that has exchange rate equal to 1 is to what all others will convert based on the chosen exchange rate in every different currency.

Here if I choose dollar as 1 and set exchange rate in hrivnya, virtumart will show wrong price in the frontend: even though hrivnya is chosen for frontend, it will then show dollar numerical value but the symbol stays as UAH (that I chose in my hrivnya construction).

Please help to solve it, thanks!



jenkinhill

VirtueMart uses the European Central Bank (ECB) daily xml conversion rate file to calculate currency values (loaded into cache). But the ECB does not publish an exchange rate for the UAH so conversion will not work. You could manually add a rate for UAH into the xml file or reprogram the currency conversion module to use an alternative source of rate data that include the UAH.

I am sure that the ECB used to publish the UAH rate as it is referenced in http://forum.virtuemart.net/index.php?topic=104622   - don't know why it does not appear to be there now.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

virtuenewbee

Thank you very much, I'm just learning VM but it is such an excellent master piece that I will go on to learn all including reprogramming this exchange rate.

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum


Milbo

We just also had the trouble with ukrain. I fear that the political stuff in ukrain maybe the reason that they removed it.

But as jenkinhill already posted, you can configure your own. You just need to update it
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

virtuenewbee

Sorry for you also felt the problem we have tons of it everyday here!

Yes, great thanks to you Masters! I solved the problem fully by just implementing own currency converter module and then selected it from VM configuration. It was surprisingly easy! Now I put conversion rate directly in PHP code. Another week for me to code a backend mod and let shop owners to input rate in my (...hope...) first finished VM-Joomla complete program.
;-)

Milbo

?

This makes not really sense. You can copy the converter, give it another name, change the URL and let your converter do it automatically. OR you go to the currency and add it there manually. To put the conversation rate into the php code is a bad idea.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

virtuenewbee

Quote from: Milbo on February 01, 2014, 11:16:27 AM
?

This makes not really sense. You can copy the converter, give it another name, change the URL and let your converter do it automatically. OR you go to the currency and add it there manually. To put the conversation rate into the php code is a bad idea.

Thanks for help, if I got you right, you mean that :
make an xml file by myself and put there something like:
<Cube currency="UAH" rate="8.7"/>

where the right way is to find a bank (I currently don't know one) which provides rate for UAH.

Sure it is not the right way to keep rate in php file.

I read some years ago books on Joomla extension programming up to advanced level but then forgot all and turned to Java/Spring :-)

Now falling in love with VM, I plan a week (next one) to return to VM and my #1 intention is to build a conversion module where a new table will be installed in DB and one could set rate in Joomla administration for it.

I will do this just as a practice for myself in approach to learning VM 2 extension programming, but generally yes, if I was not in "the country I am now", I never needed this way of programming practice, in this country everything is "the other way" :-D

Milbo

lol no damit

You can set your own currency rate, very commod in the currency list/edit. You only need the xml file if you have a bank which does it update for you. Otherwise do it just manually. You can even add bitcoins, gold, silver, lightcoins, libor, whatever.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

virtuenewbee

Thank you! Indeed now I am comfortable with how currency conversion works on VM. Will go next step learning VM2...