Post by takayuki » Thu Sep 03, 2020 11:56 am

Hi,

If I change the cookie currency value from USD to JPY, for example, from an external myOCsite.com/currencyswitch.php page like this:

Code: Select all

$ccode='JPY';
setcookie('currency', $ccode, time() + 60 * 60 * 24 * 30, '/', ".myOCsite.com");
I can verify the currency value is set to JPY in the cookie via the cookie viewer in Chrome.

**BUT**

When I ctrl-r my opencart browser window, USD still loads. And when I check the cookie value in Chrome, it has changed back to USD.

Can anyone shed some light on this? What am I missing? I'm trying to create a separate page on my OC site that loads fast and has a currency switcher, all my code, just accessing the OC db.

thanks,

takayuki

New member

Posts

Joined
Thu Aug 13, 2009 10:16 pm

Post by ADD Creative » Thu Sep 03, 2020 6:12 pm

If you look at the code for currency cookie, the session value takes precedence.
https://github.com/opencart/opencart/bl ... #L132-L159

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by takayuki » Fri Sep 04, 2020 9:17 am

Thanks for the reply. One step closer to a solution. Where are the session values stored for Opencart?

Code: Select all

print_r($_SESSION);
does not return any values.

Thanks,

Takayuki

New member

Posts

Joined
Thu Aug 13, 2009 10:16 pm

Post by ADD Creative » Fri Sep 04, 2020 6:01 pm

See.
https://github.com/opencart/opencart/bl ... on.php#L47

Are you looking after the session is started?

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: No registered users and 33 guests