Post by leisurebattery » Sun Feb 13, 2011 9:47 am

Hi,

Is there a way I can add a percentage to the Euro exchnage rate to cover banking charges?

Thanks.


Posts

Joined
Wed Sep 29, 2010 5:55 pm

Post by ridax » Mon Feb 14, 2011 6:53 am

In file /admin/model/localisation/currency.php

search for

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = NOW() WHERE code = '" . $this->db->escape($currency) . "'");
replace it with

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value * 1.02 . "', date_modified = NOW() WHERE code = '" . $this->db->escape($currency) . "'");
There 1.02 gives a 2% extra margin on the currency.

New member

Posts

Joined
Sun Jan 23, 2011 4:50 pm


Post by nick5000 » Fri Jan 04, 2013 3:20 am

ridax wrote:In file /admin/model/localisation/currency.php

search for

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value . "', date_modified = NOW() WHERE code = '" . $this->db->escape($currency) . "'");
replace it with

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value * 1.02 . "', date_modified = NOW() WHERE code = '" . $this->db->escape($currency) . "'");
There 1.02 gives a 2% extra margin on the currency.
this doesn't work with 1.5.2.1
any other way? any paid extension that can do this?

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by straightlight » Mon Mar 18, 2013 3:35 am

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '" . (float)$value * 1.02 . "', date_modified = NOW() WHERE code = '" . $this->db->escape($currency) . "'");
The OpenCart version isn't the issue here. The quotes are.

Code: Select all

$this->db->query("UPDATE `" . DB_PREFIX . "currency` SET `value` = '" . (float)$value * 1.02 . "', `date_modified` = NOW() WHERE `code` = '" . $this->db->escape($currency) . "'");
The value field is what really mattered to add the quotes but I would still suggest to keep the quotes on all other inquiries of this code as well.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by nick5000 » Tue Mar 19, 2013 4:32 pm

Thanks Straightlight!!
This works for me.

New member

Posts

Joined
Fri Apr 13, 2012 2:25 pm

Post by webpie it. » Fri May 24, 2013 4:20 pm

Can anyone update the above for 1.5.4+ the code im looking at is different:

Code: Select all

$this->db->query("UPDATE " . DB_PREFIX . "currency SET value = '1.00000', date_modified = '" .  $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($this->config->get('config_currency')) . "'");
Cant seem to get the above to work by straightlight

Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by webpie it. » Fri May 24, 2013 7:30 pm

So far i have this

line 133 in admin/model/localisation/currency.php

Code: Select all

if ((float)$value) {
					$this->db->query("UPDATE " . DB_PREFIX . "currency` SET `value` = '" . (float)$value * 1.03 . "', `date_modified` = '" .  $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
				}
			}
But just can not get it to work!

Tried clearing the system cache file for the currency too

Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by straightlight » Fri May 24, 2013 9:55 pm

But just can not get it to work!
Please clarify get it to work! .

Code: Select all

if ((float)$value) {
               $this->db->query("UPDATE " . DB_PREFIX . "currency` SET `value` = '" . (float)$value * 1.03 . "', `date_modified` = '" .  $this->db->escape(date('Y-m-d H:i:s')) . "' WHERE code = '" . $this->db->escape($currency) . "'");
            }
         }
for:

Code: Select all

if (is_float($value)) {
               $this->db->query("UPDATE " . DB_PREFIX . "currency` SET `value` = '" . (float)$value * 1.03 . "', `date_modified` = NOW() WHERE `code` = '" . $this->db->escape($currency) . "'");
            }
         }

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by webpie it. » Fri May 24, 2013 10:01 pm

Thanks for the reply!

Well what i mean is i apply the code above, the new one you just posted, but the the increase on the currency does not happen.

Do i have to wait for the currency to update automatically for it to then add the extra?

Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by webpie it. » Sat May 25, 2013 2:26 am

Update to above, i have tried everything to get the above code to work, but it just seems that it has no affect on the price of a product when you switch to a different currency other than the default currency.

I am guessing 1.03 would add 3% extra to the price in the currency selected, other than the default currency?

Regards

Chris


Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by straightlight » Sun May 26, 2013 12:17 am

I am guessing 1.03 would add 3% extra to the price in the currency selected, other than the default currency?
Yes.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by webpie it. » Sun May 26, 2013 12:36 am

Thanks for clarifying!

I'm not sure what to do on this, the code change above seems to have no affect on the prices of products when a different currency is chosen, is there anything else I should be doing?

Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by webpie it. » Sun May 26, 2013 5:56 pm

So i finally got it working!

Silly mistake, but for anyone who is doing this on a test system, you will need to unlock it if you have set a htaccess password server side.

Seemed to be blocking the update

Thanks massively again to straightlight

Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by webpie it. » Mon May 27, 2013 8:01 pm

I have returned, it still does seem that even though the currency is updating IT IS NOT adding the 3% i have applied above.

It is not applying the extra on top of the exchange rate when it updates :(

Regards

Chris


Active Member

Posts

Joined
Mon Jan 31, 2011 7:28 pm

Post by zaynab » Fri Dec 20, 2013 1:08 pm

i have this the updation how can i update here..

Currency Exchange Rates China


Newbie

Posts

Joined
Fri Dec 20, 2013 1:06 pm
Who is online

Users browsing this forum: No registered users and 394 guests