News:

Support the VirtueMart project and become a member

Main Menu

Currency conversion is not dynamic (real)

Started by hk, March 27, 2014, 13:41:40 PM

Previous topic - Next topic

hk

Hi,

My store currency is INR and the Payment method for customers from USA is Paypal which is configured in USD currency.
The currency is getting converted to USD for the customers but the conversion rate is not real. For all the orders which I received in past 1 month, the currency conversion was same.

In the configuration, Select a currency converter module is set to default i.e. convertECB.php (/administrator/index.php?option=com_virtuemart&view=config) and the exchange rate for all currencies is set to 0.00000 (/administrator/index.php?option=com_virtuemart&view=currency).

Can you let me know, what is causing the currency conversion as same for all orders.


Thanks.

Milbo

Usually the currency rate is updated 4 times a day.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hk

But all my orders had the same exchange rate. This is surprising.
Do you foresee any bug in the VM 2.0.18c?

How should I ensure that the updates are working properly.
Also as a workaround until I fix the issue, can you let me know where should I change the exchange rate for USD so that all my orders take this value for conversion.

StefanSTS

I foresee, that your site is vulnarable, because you use a version prior to 2.0.24c, which fixed earlier security issues.

Since 2.0.18 was quite some time ago, your problem might be fixed in 2.0.26d.

Mirror installation, test and go! :-)

Stefan

PS. Same for Joomla, if you still run on an old version.
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

hk

Thanks for the note!
But I cannot quickly upgrade and I will have to do lot of testing of new version before implementation.

Can you let me know the workaround solution.

Thanks.

hk

I upgraded from 2.0.18a to 2.0.26d in test region.
But the currency conversion is not happening at the real exchange rate.

Yesterday, I tried to shop the product, it showed $37.05 and today it shows the same.

Can you please advise.

Thanks.

jenkinhill

Look in Joomla root/cache/convertECB/ where you should see a file with a name something like
d9b47f88a91460d2518e2e4dc98dff5f-cache-convertECB-59d2660627d124d1f4d8403e63461a9a.php
That file contains is the last downloaded conversion rate. This should be auto updated up to 4 times a day.
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

hk

I could find a file 9833e8c7ecc062b4768aac8b70f23fd1-cache-convertECB-59d2660627d124d1f4d8403e63461a9a.php
The Last Modified date for this is Yesterday 4:21 PM IST.
This is the approximate time when I started testing the upgraded VM by creating orders.

I think something is stopping from getting the file updated.

This same file is available in my Live site which uses VM 2.0.18a

Should I delete this file and create orders to see if the latest version is picked?

jenkinhill

No the update is obviously being downloaded. You should check the fil;e to make sure it does have an exchange rate for your currency.
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

hk

I'm using INR and USD; both currencies are listed in that file.

Also, I could see there is a file daily.xml in cache folder which has similar data with
Cube time='2014-01-21'

martinex

Quote from: Milbo on March 29, 2014, 12:36:38 PM
Usually the currency rate is updated 4 times a day.

I just spent few hours finding out why my exchange rates are not updated... The problem is IMO in the convertECB.php:
$cache->setLifeTime(86400/4); // check 4 time per day
where we set seconds as the lifeTime which is then multiplied by 60 in libraries/joomla/cache/storage.php ctor... so since Joomla is expecting minutes here, we are actually updating once every 15 days.
I've changed this to:
$cache->setLifeTime(24*60/4); // check 4 time per day
and I'm fine now.

I've checked this also in latest Joomla/VM versions, so probably there is a serious bug here (or I have something really messed up in my installation)

Milbo

Thank you for pointing that out. Should be fixed next version
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

hk

I'm unable to find the code in the file libraries/joomla/cache/storage.php as mentioned below:

Quote from: martinex on November 25, 2014, 04:45:12 AM
I just spent few hours finding out why my exchange rates are not updated... The problem is IMO in the convertECB.php:
$cache->setLifeTime(86400/4); // check 4 time per day
where we set seconds as the lifeTime which is then multiplied by 60 in libraries/joomla/cache/storage.php ctor... so since Joomla is expecting minutes here, we are actually updating once every 15 days.
I've changed this to:
$cache->setLifeTime(24*60/4); // check 4 time per day
and I'm fine now.


The code available is:
public function __construct($options = array())
{
$config = JFactory::getConfig();
$this->_hash = md5($config->get('secret'));
$this->_application = (isset($options['application'])) ? $options['application'] : null;
$this->_language = (isset($options['language'])) ? $options['language'] : 'en-GB';
$this->_locking = (isset($options['locking'])) ? $options['locking'] : true;
$this->_lifetime = (isset($options['lifetime'])) ? $options['lifetime'] * 60 : $config->get('cachetime') * 60;
$this->_now = (isset($options['now'])) ? $options['now'] : time();

// Set time threshold value.  If the lifetime is not set, default to 60 (0 is BAD)
// _threshold is now available ONLY as a legacy (it's deprecated).  It's no longer used in the core.
if (empty($this->_lifetime))
{
$this->_threshold = $this->_now - 60;
$this->_lifetime = 60;
}
else
{
$this->_threshold = $this->_now - $this->_lifetime;
}

}


Can you please let me know where should I update, so that currency rates are updated 4 times a day.

Thanks.

jenkinhill

The current VM 3.0.8 version updates the ECB exchange rate xml file daily, on the first occasion the store site is used on that day.  There is no point trying to check for an xml file more often as it is only updated once each day by the ECB.............
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

hk

Thanks for the note!

I'm still using VM 2.0.26d, what should I change so that exchange rates are updated at least daily.
I need to know this, until I upgrade to VM 3.0.8

Thanks.