Post by mendozal » Tue Dec 01, 2009 3:10 am

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.
Last edited by i2Paq on Thu Aug 19, 2010 3:07 am, edited 1 time in total.
Reason: Topic moved

Newbie

Posts

Joined
Sat Oct 31, 2009 4:10 am

Post by Qphoria » 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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by crawford » Sun Sep 05, 2010 4:27 pm

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.

New member

Posts

Joined
Mon Dec 28, 2009 8:10 pm

Post by maksfeltrin » Wed Nov 16, 2011 9:12 am

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'));
 

Newbie

Posts

Joined
Wed Nov 16, 2011 9:06 am

Post by BOBKIM7080 » Thu Apr 26, 2012 5:35 pm

Is this work without any problem?
Such as geo zone and shipping charge...

User avatar
New member

Posts

Joined
Fri Aug 26, 2011 12:53 am


Post by muratim » Fri May 25, 2012 8:01 am

Hi All,

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

Thank you

Newbie

Posts

Joined
Tue May 31, 2011 3:49 pm
Location - Swindon

Post by malrubaie » Thu Mar 20, 2014 4:27 pm

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

Opencart Version 1.5.5.1


Newbie

Posts

Joined
Sun Nov 17, 2013 7:53 am

Post by GoldenTongs » Fri Jun 26, 2015 2:08 pm

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

http://Lilphones.com
Image


Active Member

Posts

Joined
Sun Jul 29, 2012 5:26 pm

Post by robster » Fri Jun 26, 2015 5:02 pm

@GoldenTongs

Useful to know. Thanks.

I know my place...!


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 8:08 pm
Location - North Yorkshire, UK

Post by Reptile » Mon Aug 29, 2016 5:28 am

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?

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by Reptile » Mon Aug 29, 2016 9:08 pm

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.

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by malshan » Fri Oct 14, 2016 12:19 am

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 :/

Newbie

Posts

Joined
Thu Oct 13, 2016 9:19 pm

Post by Reptile » Wed Nov 02, 2016 7:04 pm

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.

All my extensions: Click here or Click here


User avatar
Active Member

Posts

Joined
Mon Jan 30, 2012 7:23 pm
Location - The Netherlands

Post by Piercer » Tue Apr 18, 2017 6:45 pm

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

Newbie

Posts

Joined
Tue Apr 18, 2017 6:42 pm

Post by psytanium » Wed Jul 31, 2019 2:28 am

How can I do it in Opencart 3.0.2.0 ? I tried the above but it didn't work at all.

Active Member

Posts

Joined
Fri Nov 27, 2015 2:07 am

Post by anizam73 » Wed Sep 18, 2019 5:14 pm

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?

Newbie

Posts

Joined
Wed Feb 15, 2017 3:35 pm

Post by dedoboss » Fri Dec 20, 2019 9:12 pm

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

New member

Posts

Joined
Fri Sep 30, 2011 3:26 pm

Post by straightlight » Fri Dec 20, 2019 11:07 pm

This topic is quite old. Using an extension to handle auto-currency changes from the Marketplace should resolved the issue.

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 psytanium » Fri Sep 25, 2020 5:18 pm

Any solution for OC3.0.2.0 ?

Active Member

Posts

Joined
Fri Nov 27, 2015 2:07 am
Who is online

Users browsing this forum: No registered users and 43 guests