Post by James_K » Wed May 29, 2013 3:58 pm

Hi
We like the "Auto Update Currency" feature, but we have a slight problem with it, our local currency is GBP, but we sell a lot of items throughout Europe, so offering Euro rates helps our customers, but the rate that open cart uses on a daily basis differs from the exchange rate that PayPal (our merchant gateway) offer to exchange the Euros back into GBP.

Is there a way to bring the two rates in line, or change the update source for opencart to be the same as PayPal?

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by James_K » Wed May 29, 2013 9:22 pm

Just worked out that it is a difference of 2.9% the wrong way, so that will soon add up! :-[

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by pprmkr » Wed May 29, 2013 10:32 pm

At line 131 of admin/model/localisation/currency.php you find the value returned by finance.yahoo.com :

Code: Select all

$value = utf8_substr($line, 11, 6);
Result:
GBPEUR=X,1.1688
GBPUSD=X,1.5131
After that you could substract the 2.9% Paypal takes as provision.

Code: Select all

$value = ( $value / 102.9 * 100 );
For instance:

1 GBP = 1.1688 EUR
After calculation:
1 GBP = 1,13586 EUR

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by James_K » Wed May 29, 2013 10:44 pm

thanks!

How do i force open cart to update the rate so i can see if the code has worked?

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by rph » Wed May 29, 2013 10:45 pm

I believe it's either logging into admin or going into the store settings.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by James_K » Wed May 29, 2013 10:55 pm

hmm. have logged in and checked under site settings and currencies - but can not see anything...

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by James_K » Wed May 29, 2013 11:08 pm

this is what i have added, am i right?

Code: Select all

foreach ($lines as $line) {
				$currency = utf8_substr($line, 4, 3);
				$value = utf8_substr($line, 11, 6);
				$value = ( $value / 102.9 * 100 );

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by pprmkr » Wed May 29, 2013 11:12 pm

When in System - Settings - Store: Local -> Auto Update Currency: is set to Yes, just click on Dashboard to update the currencies.

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by James_K » Wed May 29, 2013 11:22 pm

pprmkr wrote:When in System - Settings - Store: Local -> Auto Update Currency: is set to Yes, just click on Dashboard to update the currencies.
Tried that, still no change in the admin section or on the store front.
Also tried switching the Auto Update Currency Off -> save then switch it back On, no change.

I can wait till tomorrow to see if it changes the rates then - just keen to see live changes :)

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by rph » Wed May 29, 2013 11:56 pm

It only updates once a day. You can force update the currency by editing /admin/controller/common/home.php and changing:

Code: Select all

$this->model_localisation_currency->updateCurrencies(); 
to:

Code: Select all

$this->model_localisation_currency->updateCurrencies(true); 

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by James_K » Thu May 30, 2013 1:41 am

Great that got the currency to update, but the formula was the wrong way round:

Code: Select all

foreach ($lines as $line) {
            $currency = utf8_substr($line, 4, 3);
            $value = utf8_substr($line, 11, 6);
            $value = ( $value / 102.9 * 100 );
This would equate to current exchange rate1.1667 less 2.9% = 1.1338, so before the calculation of a product costing £100, would have been 116.67 Euros, and after the calculation would be 113.38 Euros.
So the code should be:

Code: Select all

foreach ($lines as $line) {
            $currency = utf8_substr($line, 4, 3);
            $value = utf8_substr($line, 11, 6);
            $value = ( $value * 102.9 / 100 );
This would equate to current exchange rate1.1667 pluss 2.9% = 1.2005, so before the calculation of a product costing £100, would have been 116.67 Euros, and after the calculation would be 120.05 Euros.
So now when PayPal deduct 2.9% for their exchange of the Euros back into GBP we get £100.11

Thanks to everyone for the help on this, and i hope it helps others ;D

Newbie

Posts

Joined
Wed May 22, 2013 10:01 pm

Post by balloonprint » Tue Aug 16, 2016 2:02 am

Hi, we use Opencart 2.1.0.2 and we have same problem the price in EUR should be higher then now, i tried same code in currency.php but it is not change anything at all. Could you help me with this please.

Newbie

Posts

Joined
Tue Aug 16, 2016 1:55 am

Post by fido-x » Thu Aug 18, 2016 7:27 pm

PayPal's exchange rates are different to the official exchange rates. They designed to make money for PayPal when used to convert currencies.

The best method is to add the other currencies to your PayPal and your store, so that you can accept payment in the other currencies. That way, any loss (or profit) from exchanging currencies is borne by you and not your customer.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by balloonprint » Sun Aug 21, 2016 8:09 pm

James_K wrote:Great that got the currency to update, but the formula was the wrong way round:

Code: Select all

foreach ($lines as $line) {
            $currency = utf8_substr($line, 4, 3);
            $value = utf8_substr($line, 11, 6);
            $value = ( $value / 102.9 * 100 );
This would equate to current exchange rate1.1667 less 2.9% = 1.1338, so before the calculation of a product costing £100, would have been 116.67 Euros, and after the calculation would be 113.38 Euros.
So the code should be:

Code: Select all

foreach ($lines as $line) {
            $currency = utf8_substr($line, 4, 3);
            $value = utf8_substr($line, 11, 6);
            $value = ( $value * 102.9 / 100 );
This would equate to current exchange rate1.1667 pluss 2.9% = 1.2005, so before the calculation of a product costing £100, would have been 116.67 Euros, and after the calculation would be 120.05 Euros.
So now when PayPal deduct 2.9% for their exchange of the Euros back into GBP we get £100.11

Thanks to everyone for the help on this, and i hope it helps others ;D
Can you advise me please what code i can use for Opencart 2.1.0.2? I tried to do what you said but it is not work.

Newbie

Posts

Joined
Tue Aug 16, 2016 1:55 am
Who is online

Users browsing this forum: No registered users and 37 guests