News:

Looking for documentation? Take a look on our wiki

Main Menu

Error in currency conversion rules?

Started by role74, February 03, 2015, 13:04:46 PM

Previous topic - Next topic

role74

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.


       
  • The shops currency and accepted currency is swiss francs, set in Shop/Configuration.
  • convertECB.php Module is activated in Configuration/Configuration
  • In the currencies activated are Euro and Swiss Franc in the Configuration/Currencies.
  • todays exchange rate is around 1.05 swiss francs for one euro
  • no calculation rules except VAT
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

Milbo

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

role74

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

Milbo

It is an xml file. in the cache folder.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

role74

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

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

role74

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

GJC Web Design

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"
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

role74

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?