Page 1 of 1

Help Needed - How to manually trigger a currency change.

Posted: Tue Dec 01, 2009 3:10 am
by mendozal
Hi.
In some point of the checkout process I need to manually (via php code) trigger a currency change of the ammounts. Let's say the user chooses to use EUROS but to complete the order I need to convert everything to USD.

Wich will be the best way to do that? Can I call some function in the Currency Module to do this?

Thanks.

Re: Help Needed - How to manually trigger a currency change.

Posted: Tue Dec 01, 2009 5:19 am
by Qphoria
I've added that step into all my payment modules to convert it automatically so that the page doesn't have to change. But if you want to actually trigger the change on the page for modules that don't have currency support, you can:

If using 1.4.x:

1. EDIT:
catalog/controller/checkout/confirm.php <--normal checkout
and
catalog/controller/checkout/guest_step_3.php <-- guest checkout

2. FIND:

Code: Select all

$total_data = array();
3. BEFORE, ADD:

Code: Select all

$this->currency->set('USD');

if using 1.5.x/2.x:

1. EDIT: catalog/controller/checkout/checkout.php

2. FIND:

Code: Select all

public function index() {
3. AFTER, ADD:

Code: Select all

$this->currency->set('USD');

That will force the site to always change to USD when it hits the confirm page

Re: Help Needed - How to manually trigger a currency change.

Posted: Sun Sep 05, 2010 4:27 pm
by crawford
Qphoria wrote:Ok I've updated the post above to mention the guest checkout as well
Ah, two different checkout files, I didn't realize that.

Thank you & nice weekend,

Michael W.

Re: Help Needed - How to manually trigger a currency change.

Posted: Wed Nov 16, 2011 9:12 am
by maksfeltrin
I think it should be added before $total_data, $total, $taxes calculations made by total extensions:

i put it just after:

Code: Select all

if (!$json) { 
around line 57

Code: Select all

$this->currency->set($this->config->get('config_currency'));
 

Re: Help Needed - How to manually trigger a currency change.

Posted: Thu Apr 26, 2012 5:35 pm
by BOBKIM7080
Is this work without any problem?
Such as geo zone and shipping charge...

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri May 25, 2012 8:01 am
by muratim
Hi All,

As your refence I have edited the EDIT: catalog/controller/checkout/checkout.php thank you for this, it works perfect.

Thank you

Re: Help Needed - How to manually trigger a currency change.

Posted: Thu Mar 20, 2014 4:27 pm
by malrubaie
Qphoria wrote:I've added that step into all my payment modules to convert it automatically so that the page doesn't have to change. But if you want to actually trigger the change on the page for modules that don't have currency support, you can:

If using 1.4.x:

1. EDIT:
catalog/controller/checkout/confirm.php <--normal checkout
and
catalog/controller/checkout/guest_step_3.php <-- guest checkout

2. FIND:

Code: Select all

$total_data = array();
3. BEFORE, ADD:

Code: Select all

$this->currency->set('USD');

if using 1.5.x:

1. EDIT: catalog/controller/checkout/checkout.php

2. FIND:

Code: Select all

$this->language->load('checkout/checkout');
3. AFTER, ADD:

Code: Select all

$this->currency->set('USD');

That will force the site to always change to USD when it hits the confirm page

works great thank you

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Jun 26, 2015 2:08 pm
by GoldenTongs
i know this is an old thread, but i have just had to go through this,
and thought info may be handy for anyone
but when you force paypal to accept your default currency (your currency)
paypal then displays their conversion aswell to customer which is what customer pays (their currency)
(as really you pass on paypals crap conversion rate to the customer)
but this may be different to what customer was shown when viewing website
to get around this i add 3% on website conversion to cover any difference
so when they see conversion on paypal it should be same or lower than your conversion displayed on site
see
http://forum.opencart.com/viewtopic.php?f=19&t=102948

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Jun 26, 2015 5:02 pm
by robster
@GoldenTongs

Useful to know. Thanks.

Re: Help Needed - How to manually trigger a currency change.

Posted: Mon Aug 29, 2016 5:28 am
by Reptile

Code: Select all

$this->currency->set('USD');
This doesn't work anymore more in 2.3.0.2.
Does anybody know another way to force your currency?

Re: Help Needed - How to manually trigger a currency change.

Posted: Mon Aug 29, 2016 9:08 pm
by Reptile
Nevermind I figured it out.

For Opencart 2.3.x you can use this:

Code: Select all

$this->session->data['currency'] = 'EUR';
Replace EUR with the currency you want it to be.

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Oct 14, 2016 12:19 am
by malshan
Reptile wrote:Nevermind I figured it out.

For Opencart 2.3.x you can use this:

Code: Select all

$this->session->data['currency'] = 'EUR';
Replace EUR with the currency you want it to be.

This will turn whole website to EUR :/

Re: Help Needed - How to manually trigger a currency change.

Posted: Wed Nov 02, 2016 7:04 pm
by Reptile
malshan wrote:
Reptile wrote:Nevermind I figured it out.

For Opencart 2.3.x you can use this:

Code: Select all

$this->session->data['currency'] = 'EUR';
Replace EUR with the currency you want it to be.

This will turn whole website to EUR :/

No only at the checkout.
And you can easily switch back on the website using the currency switcher.

Re: Help Needed - How to manually trigger a currency change.

Posted: Tue Apr 18, 2017 6:45 pm
by Piercer
Hi.
Is it possible to add additional currency Total in the invoice that is sent to a customer? So let it be like...

Order: € 30
Shipping to Europe and USA: € 40
Total: € 70
Total in USD: $ 85
Total in GBP: 102

Re: Help Needed - How to manually trigger a currency change.

Posted: Wed Jul 31, 2019 2:28 am
by psytanium
How can I do it in Opencart 3.0.2.0 ? I tried the above but it didn't work at all.

Re: Help Needed - How to manually trigger a currency change.

Posted: Wed Sep 18, 2019 5:14 pm
by anizam73
Qphoria wrote:
Tue Dec 01, 2009 5:19 am
I've added that step into all my payment modules to convert it automatically so that the page doesn't have to change. But if you want to actually trigger the change on the page for modules that don't have currency support, you can:

If using 1.4.x:

1. EDIT:
catalog/controller/checkout/confirm.php <--normal checkout
and
catalog/controller/checkout/guest_step_3.php <-- guest checkout

2. FIND:

Code: Select all

$total_data = array();
3. BEFORE, ADD:

Code: Select all

$this->currency->set('USD');

if using 1.5.x/2.x:

1. EDIT: catalog/controller/checkout/checkout.php

2. FIND:

Code: Select all

public function index() {
3. AFTER, ADD:

Code: Select all

$this->currency->set('USD');

That will force the site to always change to USD when it hits the confirm page
Hi,

Will this setting work with Journal 2 Theme?

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Dec 20, 2019 9:12 pm
by dedoboss
Hello everybody
it seems not working on my website...
Using OC 2.1.0.2 and Journal2 theme

can anybody help me with this?
thanks
Diego

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Dec 20, 2019 11:07 pm
by straightlight
This topic is quite old. Using an extension to handle auto-currency changes from the Marketplace should resolved the issue.

Re: Help Needed - How to manually trigger a currency change.

Posted: Fri Sep 25, 2020 5:18 pm
by psytanium
Any solution for OC3.0.2.0 ?