Post by vthompson » Fri Feb 05, 2021 11:34 am

I just installed ver 3.0.3.7 and going through editing the store details

System -> Settings -> Store -> Local -> Time Zone

I set the time zone to America/Detroit (-5:00) and was unable to login. I found several posts which addressed this issue, but the one which worked was changing the session engine from db to file in the system/config/default.php and system/config/catalog.php files.

Perhaps this is telling me I need to set the time zone to match somewhere else, but it would be nice if there was a heads up that this result is a possibility, even a check during the initial pre-install list.
Last edited by vthompson on Sat Feb 06, 2021 2:15 pm, edited 2 times in total.

Newbie

Posts

Joined
Fri Feb 05, 2021 11:25 am

Post by sw!tch » Fri Feb 05, 2021 6:23 pm

You sure you installed 3.0.3.6 ? As far as I know there is no timezone setting by default in 3.0.3.6.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by vthompson » Sat Feb 06, 2021 1:04 pm

sw!tch wrote:
Fri Feb 05, 2021 6:23 pm
You sure you installed 3.0.3.6 ? As far as I know there is no timezone setting by default in 3.0.3.6.
I said "I set the timezone". No, it is not set by default.

Newbie

Posts

Joined
Fri Feb 05, 2021 11:25 am

Post by Majnoon » Sat Feb 06, 2021 1:20 pm

vthompson wrote:
Sat Feb 06, 2021 1:04 pm
No, it is not set by default.
How did you got that option there? Because as per Switch comments there is no default option for that.
Have you installed some extension or m modified the core code etc?

Active Member

Posts

Joined
Fri Feb 05, 2021 8:29 pm

Post by vthompson » Sat Feb 06, 2021 1:40 pm

Majnoon wrote:
Sat Feb 06, 2021 1:20 pm
vthompson wrote:
Sat Feb 06, 2021 1:04 pm
No, it is not set by default.
How did you got that option there? Because as per Switch comments there is no default option for that.
Have you installed some extension or m modified the core code etc?
I'm sorry but I feel like my original post is not being read. I literally posted how I got there. I was going through the settings and figured setting the timezone would be a fine thing to do. Once I set it and saved, I was logged out and had no way to get back to normal, short of wiping and starting over. I posted how it was solved and thoughts on preventing others from doing it. Searching shows other people have encountered the issue too. It's been ongoing for several versions at least.

Newbie

Posts

Joined
Fri Feb 05, 2021 11:25 am

Post by by mona » Sat Feb 06, 2021 1:55 pm

You post has been read and understood by 3 people.
However the part that you are not understanding is there is no place to set the timezone in Opencart to best of our knowledge. If you know better please send a screenshot.
There is also no System -> Settings -> Store -> Local -> Time Zone -
There is System -> Settings -> Store and there is System -> Settings -> Local

This is not a bug, at least not in Opencart, but we do thank you for assisting someone - we are just not sure who.
Last edited by by mona on Sat Feb 06, 2021 1:58 pm, edited 1 time in total.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by sw!tch » Sat Feb 06, 2021 1:57 pm

I think the confusion is you actually downloaded 3.0.3.7 release. (it was just released) There was a bug in the intial release where they failed to update the version, it was being reported as 3.0.3.6 in the admin panel.

The timezone setting wasn't available by default in opencart prior to 3.0.3.7, unless you installed a marketplace extension.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by by mona » Sat Feb 06, 2021 1:58 pm

:clap:

This is going to be fun :laugh:

AND @vthompson thank you again - would you mind changing the title to 3.0.3.7 and adding [SOLVED] as that will be of use to many people I suspect .. :ok:

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


https://www.youtube.com/watch?v=zXIxDoCRc84


User avatar
Expert Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by vthompson » Sat Feb 06, 2021 2:07 pm

Well, if it's 3.0.3.7, fine. The issue still stands. I attached the screenshot of setting the timezone.

Attachments

settings-screen.jpg

settings-screen.jpg (129.32 KiB) Viewed 15229 times


Newbie

Posts

Joined
Fri Feb 05, 2021 11:25 am

Post by sw!tch » Sat Feb 06, 2021 4:49 pm

vthompson wrote:
Sat Feb 06, 2021 2:07 pm
Well, if it's 3.0.3.7, fine. The issue still stands. I attached the screenshot of setting the timezone.
Looks like this is a valid bug, haven't spent enough time on 3.0.3.7 to look into it, but was able to quickly duplicate. Since it potentially deals with sessions, the fix should really be addressed from the core.

You could open an issue request on Opencarts Github.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by straightlight » Sun Feb 07, 2021 1:26 pm

Untested but in admin/controller/setting/setting.php file,

Edit: Modification has been known to not working; error with string as an array given. Codes removed.
Last edited by straightlight on Tue Mar 16, 2021 10:44 am, edited 1 time in total.

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 sukhbirgs » Wed Feb 10, 2021 6:14 am

There could be another issue for 3.0.3.7, i was getting api error editing admin order's and tracked it down to System->framework.php

line : 84
// Sync PHP and DB time zones
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");

For me it was executing "SET time_zone = '+00:00'" where as i am in +7
Commenting out this line and i am able to edit order's.
Good luck

Newbie

Posts

Joined
Sat Oct 01, 2016 5:24 am

Post by straightlight » Wed Feb 10, 2021 10:10 am

sukhbirgs wrote:
Wed Feb 10, 2021 6:14 am
There could be another issue for 3.0.3.7, i was getting api error editing admin order's and tracked it down to System->framework.php

line : 84
// Sync PHP and DB time zones
$db->query("SET time_zone = '" . $db->escape(date('P')) . "'");

For me it was executing "SET time_zone = '+00:00'" where as i am in +7
Commenting out this line and i am able to edit order's.
Good luck
Which PHP version are you using?

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 sw!tch » Wed Feb 10, 2021 7:06 pm

I think the problem lies in framework.php with the date_default_timezone_set($config->get('date_timezone'));

For example: If you look at the following line https://github.com/opencart/opencart/bl ... rk.php#L15

In framework.php it's set default to UTC, it is probably taking priority over date() in the session DB class before the startup.php timezone override can be called.

If that's the case, then the timezone becomes out of sync and would cause the login issue. This could also explain why it works with file sessions as the OP mentioned ( no query is done with file sessions).

If you encounter this, open an issue ticket on the OC GitHub so it can be looked into as its better addressed from the core.

If you get locked out or cannot login try setting the Timezone back to UTC

In phpmyadmin go to your oc_setting table and under the key column look for config_timezone, set the value back to UTC, clear your browser history and try to login again.
-

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm

Post by alejandroalcala » Sun Feb 28, 2021 12:04 am

The solution below provided by straightlight, was sucefully applied in my OpenCart installation 3.0.3.7

Waiting for an official update.

Thank You.
Last edited by alejandroalcala on Sun Feb 28, 2021 1:24 am, edited 1 time in total.


Posts

Joined
Tue Jun 23, 2020 2:27 pm

Post by straightlight » Sun Feb 28, 2021 12:25 am

alejandroalcala wrote:
Sun Feb 28, 2021 12:04 am
The solution below provided by Stream, was sucefully applied in my OpenCart installation 3.0.3.7

Waiting for an official update.

Thank You.
What solution?

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 xxvirusxx » Sun Feb 28, 2021 1:04 am

vthompson wrote:
Fri Feb 05, 2021 11:34 am
session engine from db to file in the system/config/default.php
Like in Master Branch

https://github.com/opencart/opencart/bl ... lt.php#L39

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by alejandroalcala » Sun Feb 28, 2021 1:26 am

straightlight wrote:
Sun Feb 28, 2021 12:25 am
alejandroalcala wrote:
Sun Feb 28, 2021 12:04 am
The solution below provided by Stream, was sucefully applied in my OpenCart installation 3.0.3.7

Waiting for an official update.

Thank You.
What solution?
Solution that you provide. Fixed your name, sorry hehehehehe (i am learning about how to post correctly in forums).
Now my installation of open cart works fine...


Posts

Joined
Tue Jun 23, 2020 2:27 pm

Post by straightlight » Sun Feb 28, 2021 3:33 am

alejandroalcala wrote:
Sun Feb 28, 2021 1:26 am
straightlight wrote:
Sun Feb 28, 2021 12:25 am
alejandroalcala wrote:
Sun Feb 28, 2021 12:04 am
The solution below provided by Stream, was sucefully applied in my OpenCart installation 3.0.3.7

Waiting for an official update.

Thank You.
What solution?
Solution that you provide. Fixed your name, sorry hehehehehe (i am learning about how to post correctly in forums).
Now my installation of open cart works fine...
Excellent, thanks for your feedback.

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 straightlight » Sun Feb 28, 2021 11:59 pm

ClaudePlouffe wrote:
Sun Feb 28, 2021 11:51 pm
It think the problem is in the system/framework.php which is setting timezone to 'date_timezone' even after a 'config_time zone' is set in admin/controller/setting/setting.php

Here's my fix

in system/framework.php replace
date_default_timezone_set($config->get('date_timezone'));

with
if ($config->has('config_timezone')) {
date_default_timezone_set($config->get('config_timezone'));
} else {
date_default_timezone_set($config->get('date_timezone'));
}
Either solution could work in this scenario.

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
Who is online

Users browsing this forum: No registered users and 30 guests