Post by Tcalp » Wed Dec 12, 2012 1:10 pm

For those who prefer not to hard edit files, I released an extension a while ago that is entirely vqmod and provides a full featured setting in the store settings panel, and adds time displays to orders, etc..

http://www.opencart.com/index.php?route ... on_id=9407

Increase Page Speed (#1 rated commercial extension on OpenCart Marketplace)
15in1 Essential Extensions Value Pack Premium Customer Testimonials Reward Points Extended Admin Security Lockdown Suite

Image
irc.freenode.net #opencart


User avatar
Active Member

Posts

Joined
Wed Jul 06, 2011 1:49 pm

Post by Snufkin » Wed Dec 12, 2012 2:39 pm

It seemed that problem in system/database/mysql.php part.
VQMOD can't change this file. I don't know why :( No errors.
I was happy and says that it work, but forgot to redo changes in mysql.php :(

May there is some professional which can describe, why it's not worked?

Newbie

Posts

Joined
Tue Jun 08, 2010 1:10 am

Post by gurubob » Wed Dec 12, 2012 5:09 pm

I found out why - it's because vqmod only works on files that have been loaded using the vqmod method. When you first install vqmod it updates the main index.php in OpenCart to load it's includes using vqmod as a wrapper. This is the injection mechanism for vqmod to operate. The database library script (system/library/db.php) however is not updated, but since the db.php itself CAN be updated via vqmod then we can change that so that it can then allow the mysql.php (etc) DB drivers to be vqmoddable themselves.

Anyway, the attached file has this change in it - try it out and see how it goes for you. Note that the original .xml included code to set the PHP time zone - I have removed it because it was set to an explicitly named zone (will save those people who are too lazy or don't understand the xml files). You should set the timezone in your php.ini or .htaccess file. Or put it back into the XML.

--
Bob Brown, Web Developer
Turboweb Limited, www.turboweb.co.nz
Twitter: @gurubobnz, Facebook: facebook.com/turboweb


User avatar
Newbie

Posts

Joined
Fri May 21, 2010 7:09 pm
Location - Dunedin, NZ

Post by gurubob » Wed Dec 12, 2012 7:12 pm

Whoops - my xml file broke the admin. Use this attached file instead ;D

--
Bob Brown, Web Developer
Turboweb Limited, www.turboweb.co.nz
Twitter: @gurubobnz, Facebook: facebook.com/turboweb


User avatar
Newbie

Posts

Joined
Fri May 21, 2010 7:09 pm
Location - Dunedin, NZ

Post by crojo » Sat Dec 15, 2012 12:17 pm

Why don't people just use

Code: Select all

date.timezone = "Australia/Melbourne"
inside php.ini ?


http://php.net/manual/en/datetime.confi ... e.timezone
http://php.net/manual/en/timezones.php

User avatar
New member

Posts

Joined
Thu Sep 20, 2012 12:14 pm

Post by Snufkin » Sat Dec 15, 2012 6:22 pm

crojo wrote:Why don't people just use

Code: Select all

date.timezone = "Australia/Melbourne"
inside php.ini ?
For me, for example, this didn't work :(

Newbie

Posts

Joined
Tue Jun 08, 2010 1:10 am

Post by MrTech » Wed Dec 19, 2012 3:53 am

If you value your time (pun intended) and just want a solution that works, my Essentials Starter Pack v1 has local time built-in, also displays local time on dashboard and error log page for convenience, plus 20 more tweaks...

Special offer if you want to take advantage of holiday pricing. Free install and free support for anyone that asks.

~
Install Extensions OR OpenCart Fast Service! PayPal Accepted
I will professionally install and configure any free or purchased theme, module or extension.

Visit http://www.mrtech.ca if you need an OpenCart webmaster
~


User avatar
Active Member

Posts

Joined
Mon Jan 09, 2012 2:39 pm
Location - Canada, Eh!

Post by yiyinlah » Tue Mar 05, 2013 6:35 pm

Thank you! :)
I've got vqmod installed too but didn't find such option to change..

So all in all, I only modified the system/startup.php & mysql.

Still works great! (^_^)

I'm using Opencart 1.5.4.1 & vQmod 2.3.2.


User avatar
Active Member

Posts

Joined
Thu Sep 23, 2010 1:19 pm
Location - Singapore

Post by Cleo » Wed Mar 06, 2013 2:15 am

Same for me, nothing in vqmod, so I change the other 2 and it work perfectly!

Thank you for sharing!

Cleo

My EN Store
My FR Store
Opencart v1.5.4.1 fr/en
Theme: Custom
vqmod-2.6.0


User avatar
Active Member

Posts

Joined
Wed Mar 09, 2011 5:19 am

Post by maksfeltrin » Fri May 03, 2013 10:57 pm

why not just set:

date_default_timezone_set('Europe/Rome');
ini_set('date.timezone', 'Europe/Rome');

in config.php ?

i usually use a common config.php inherited by admin and catalog config.

To set MySQL connection time_zone there is a P format for date function:

date('P') return +1:00, -03:00 etc etc

Newbie

Posts

Joined
Wed Nov 16, 2011 9:06 am

Post by thomash2 » Mon Sep 09, 2013 5:12 am

When placing an order at 14:00 in my +2:00 time zone, the default opencart installation will return 8:00 UTC, when it should be 12:00 UTC. The server is in Eastern Time in the USA. I tried both of the following:
in startup.php
date_default_timezone_set('Europe/Berlin');

in php.ini
date.timezone = Europe/Berlin;

In both options, the time returned is still 8:00 +2:00 CEST, so the hour stays the same, although the zone is updated.

I tried <?php echo date("D M j G:i:s T Y"); ?> in my header, and it shows the correct time.

I tried in mysql admin:
SET time_zone = '+2:00'; SELECT NOW(); //and the time actually shows correct at 14:00
SELECT NOW(); // shows the server time at 8:00
SELECT @@global.time_zone, @@session.time_zone; //shows both values as SYSTEM

I assume that everytime I add a date into the database with the NOW() function, I'm getting the server time. But I wonder how date.timezone = Europe/Berlin; changes the echo in my header.

New member

Posts

Joined
Tue Jul 30, 2013 12:44 am

Post by thomash2 » Mon Sep 09, 2013 6:32 am

I tried keithtb's code with the small change from "connection" to "link" and it works. I made the change to mysql.php directly, and the change to vq2_system_startup.php. Without the change to vq2_system_startup.php, I tried adding:
date.timezone = Europe/Berlin;
To php.ini in the root. This changed the zone for catalog, but admin still showed as UTC. Perhaps it should be added to the php.ini also in the admin folder, but I went ahead and just changed it in the startup.php.

Now the database is actually storing the time based on the local time of Europe/Berlin.

But it was strange that previously the time being stored was -6:00 from UTC, while the code only compares local time to UTC, which is a difference of +2:00.

But also when I enter SET time_zone = '+2:00'; SELECT NOW(); into mysql, I get the correct time. So I guess SET time_zone is an offset based on UTC.

New member

Posts

Joined
Tue Jul 30, 2013 12:44 am

Post by ocdev » Fri Oct 04, 2013 8:20 am

timezone settings for your region may be found here:
http://php.net/manual/en/timezones.america.php

New member

Posts

Joined
Wed Sep 11, 2013 3:53 am
Location - Texas

Post by robzcuy » Wed Nov 06, 2013 11:18 am

Hello, i have something to ask about this.

I've tried to change my local timezone too and on my localhost, everything is works (my location in Indonesia). All i do is change system/startup line 50 into : date_default_timezone_set('Asia/Jakarta');

But when i tried to applied the timezone on my hosting (My hosting on namecheap, server located on UK), the code doesnt work :'(

Have tried to contact the technical support but it seems like they dont know the problem also.

Please can anybody help me about this ? Is there some additional code that i have to put on my server hosting ? :(

Thanks a lot before ~

Newbie

Posts

Joined
Sat Nov 24, 2012 1:03 pm

Post by butte » Wed Nov 06, 2013 1:56 pm

robzcuy, you might try on the server the prior syntax, gmt+8 (or so), which made sense in quite a few contexts but became deprecated when for some reason decision was made to make time model-city-based instead, during the series of php.exe 5.x releases. The server in England may be able still to use sensible gmt+/-.
Last edited by butte on Thu Nov 07, 2013 4:54 am, edited 1 time in total.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by NagaBaba3 » Thu Nov 07, 2013 2:59 am

Has anyone got this working for 1.5.5.1? I've made all the changes but nothing seems to be working. There's no error either.

Newbie

Posts

Joined
Sat Oct 05, 2013 11:07 pm

Post by butte » Thu Nov 07, 2013 5:28 am

On a shared host you will not be able to reset the server's own system time, but in your host control panel there m-i-g-h-t be a setting for time offset to be used within in your account. You might be able to set php.ini for your account there. Settings made in your two php.ini files should normally be the same (/ and /admin/), but some servers ignore the php.ini files. There should be a set of server php primary error logs accessible and downloadable in the control panel. Those may tell what if anything is not right with time; probably nothing is wrong. Servers normally do stay on Standard time on Zero Longitude, taking in gmt, utc, cust, zulu, and variants, in order to stay on common time in their global network. Time offsets are made well above the operating system's kernel (where in turn time corrections may be made, and w-i-l-l be made if system admins or users notice even trivial time creep).

None of that is a fault of any version of OC. None of it is done by any version of OC except by way of any gui settings or hard code that may impose an offset. The php lingo for timezones used to be what everybody else who is serious still uses, gmt+/-n or utc/cust/zulu equivalents, but php.exe was redone to use instead region/city. Which lingo works, no matter how perfect its syntax may be, depends upon which php.exe version is in effect -- old enough php.exe will consider new time to be an error, and new enough php.exe will consider old time to be deprecated and error. Some of you will be dealing with php.exe ranging even back into 4.x or somewhere through 5.x, and will need the right vintage of tricks.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by robzcuy » Fri Nov 08, 2013 10:54 am

@butte : Have tried to change into :

date_default_timezone_set('GMT+7');
date_default_timezone_set('UTC+7');
date_default_timezone_set('UTC+07:00');

Nothing works, can you please help me about this ? :'(

Newbie

Posts

Joined
Sat Nov 24, 2012 1:03 pm

Post by butte » Fri Nov 08, 2013 12:17 pm

robzcuy, which php.exe version is running? If not, there are two quick ways to check that, control panel php settings, or phpinfo.php on your server and addressed in your browser (just as you would pinpoint index.php, phpinfo.php instead).

. . . Just went back and dredged up the link:
how: upload into /admin/, address it as http: // [...]/admin/phpinfo.php in browser address bar
file: http://forum.opencart.com/download/file.php?id=18153

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by robzcuy » Sat Nov 09, 2013 10:06 am

It says : PHP Version 5.3.27

What must i do now ?

Newbie

Posts

Joined
Sat Nov 24, 2012 1:03 pm
Who is online

Users browsing this forum: Bing [Bot] and 48 guests