VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: role74 on February 03, 2015, 13:04:46 PM

Title: Error in currency conversion rules?
Post by: role74 on February 03, 2015, 13:04:46 PM
Hi there

I run VM 2.6.14 on Joomla 2.5.28 and noticed a strange behaviour in the currency conversion rules i can't explain. Maybe someone may help me on that issue.

When I define a product and set the cost price to 100 Euro, it shows me the vendor price 98.16 Swiss Francs. That is completely wrong!
According to the exchange rate this must be appx. 105 swiss francs.

BTW: I checked the exchange rate from the ecb site where the convertECB.php gets the data from and the xml file states <Cube currency="CHF" rate="1.0519"/>. Unfortunately the Configuration/Currency doesn't show any conversion rates, everywhere just 0.0000, so I can't verify the correctness.

Any ideas, suggestions?

thanks alot!
-roland
Title: Re: Error in currency conversion rules?
Post by: Milbo on February 04, 2015, 18:33:43 PM
I tried to reproduce, I get the correct values. First I thought the reason is that your shop runs in chf, the product is in euro and you sell in euro. But works, regardless if I sell in euro and edit the product in euro and have as display CHF or vice versa.
Title: Re: Error in currency conversion rules?
Post by: role74 on February 04, 2015, 20:53:33 PM
hmmmm

i run the shop in chf and when I define the product price in euro the exchange rate is way too low, same when i try in british pound. always about 6...7% too low.

any idea what this could be?
or what table I can check to see the conversion factor it transmits from the ecb?

thanks alot
-roland
Title: Re: Error in currency conversion rules?
Post by: Milbo on February 04, 2015, 23:00:46 PM
It is an xml file. in the cache folder.
Title: Re: Error in currency conversion rules?
Post by: role74 on February 07, 2015, 20:45:02 PM
Got it.... it states
s:3:"CHF";s:6:"0.9816"
That explains alot. But I expect it's a result after the script calculated some things before and not the direct input form the ECB.

but don't know where these valus are from and the date says it's about 4 days old...

any ideas how to check if the script is working correct?

thaks alot
-roland
Title: Re: Error in currency conversion rules?
Post by: GJC Web Design on February 08, 2015, 00:41:56 AM
administrator\components\com_virtuemart\plugins\currency_converter\convertECB.php

but that snippet you show looks like JSON?

should be

<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
   <gesmes:subject>Reference rates</gesmes:subject>
   <gesmes:Sender>
      <gesmes:name>European Central Bank</gesmes:name>
   </gesmes:Sender>
   <Cube>
      <Cube time='2015-01-29'>
         <Cube currency='USD' rate='1.1315'/>
         <Cube currency='JPY' rate='133.43'/>
         <Cube currency='BGN' rate='1.9558'/>
         <Cube currency='CZK' rate='27.792'/>
         <Cube currency='DKK' rate='7.4440'/>
         <Cube currency='GBP' rate='0.74775'/>
         <Cube currency='HUF' rate='312.00'/>
         <Cube currency='PLN' rate='4.2324'/>
         <Cube currency='RON' rate='4.4405'/>
         <Cube currency='SEK' rate='9.3245'/>
         <Cube currency='CHF' rate='1.0372'/>

think the function is called every time a currency conversion is rendered - cache time is checked  - if older than 6 hours grabs a new one
Title: Re: Error in currency conversion rules?
Post by: role74 on February 08, 2015, 14:13:21 PM
I found the file mentioned in the administrator cache.

It's dated 8th of january and shows the following values:

<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
   <gesmes:subject>Reference rates</gesmes:subject>
   <gesmes:Sender>
      <gesmes:name>European Central Bank</gesmes:name>
   </gesmes:Sender>
   <Cube>
      <Cube time='2015-01-08'>
         <Cube currency='USD' rate='1.1768'/>
         <Cube currency='JPY' rate='141.00'/>
...
         <Cube currency='GBP' rate='0.78110'/>
...
         <Cube currency='SEK' rate='9.4340'/>
         <Cube currency='CHF' rate='1.2010'/>
         <Cube currency='NOK' rate='9.0280'/>
...
      </Cube>
   </Cube>
</gesmes:Envelope>

This is still far away from 1.05 exchange rate and was in the past when it was 1.2x about one month ago.
But this does not explain the 0.985 it's calculating at the moment.

And it seems the currencies are not updated at the moment.
How to check this?

thanks alot
-roland
Title: Re: Error in currency conversion rules?
Post by: GJC Web Design on February 09, 2015, 00:49:26 AM
why is it out of date? should fire on every conversion

change your currency module a few times - see if a new xml is d/l'd

and where did u find this-> u have never said?

s:3:"CHF";s:6:"0.9816"
Title: Re: Error in currency conversion rules?
Post by: role74 on February 11, 2015, 21:08:04 PM
found the file in the cache/convertECB

I deleted the whole content of the cache directory and administrator/cache. Guess what happened...it worked for about 2 days then it stuck again at the same old 0.9815 exchange rate I don't know where it's coming from. Deleted the cache again and it currently works again. the daily.xml file is now updated too.

seems the cache is causing the problems. any ideas?