Post by allgoo » Sat Feb 20, 2016 12:55 am

hello,

i use a shared host on hostgator and i wasn't to change the local time zone so the products can be displayed in the local time and i can control the offers times correctly and the shipping dispatches.

i have been searching for 2 days for a solution but non solved my case

i have tried to do the following
* add SetEnv TZ Etc/GMT-3 in .htacceess
* change date_default_timezone_set('Etc/GMT-3'); in system/startup.php
* add <?php
putenv("TZ=Etc/GMT-3");
?>
<?php
date_default_timezone_set("Etc/GMT-3");
?> in /index.php and admin/index.php and
* add mysql_query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysql.php
* add $this->link->query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysqli.php

and nothing worked till now !

please help me find a solution for this

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by IP_CAM » Sat Feb 20, 2016 2:06 am

checked here already?

http://www.opencart.com/index.php?route ... h=timezone

Ernie
openshop.li

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by allgoo » Sat Feb 20, 2016 3:13 am

i was hoping to find a free solution for it , but now i think i have other thoughts, thanks

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by EvolveWebHosting » Sat Feb 20, 2016 7:21 am

allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
The first 3 listed are free

Opencart Hosting Plans, Domain Registration, Microsoft and Google Email and More
Visit our website for great deals and most importantly, fast and friendly support - www.evolvewebhosting.com


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA

Post by allgoo » Sat Feb 20, 2016 11:06 am

EvolveWebHosting wrote:
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
The first 3 listed are free
not for oc 2.1.0.2

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by IP_CAM » Sat Feb 20, 2016 11:43 am

that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out... ;)
you got a 50/50 Chance, to get it for free! It should be worth that much... :D
Ernie

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by artcore » Sat Feb 20, 2016 3:43 pm

http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by vincent_angbt » Mon Feb 22, 2016 10:22 am

allgoo wrote:hello,

i use a shared host on hostgator and i wasn't to change the local time zone so the products can be displayed in the local time and i can control the offers times correctly and the shipping dispatches.

i have been searching for 2 days for a solution but non solved my case

i have tried to do the following
* add SetEnv TZ Etc/GMT-3 in .htacceess
* change date_default_timezone_set('Etc/GMT-3'); in system/startup.php
* add <?php
putenv("TZ=Etc/GMT-3");
?>
<?php
date_default_timezone_set("Etc/GMT-3");
?> in /index.php and admin/index.php and
* add mysql_query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysql.php
* add $this->link->query("SET time_zone = 'Etc/GMT-3'"); in system/library/db/mysqli.php

and nothing worked till now !

please help me find a solution for this
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');

and put this in:
date_default_timezone_set('America/Los_Angeles');

But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by Burt65 » Mon Feb 22, 2016 10:38 am

allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI

http://www.opencart.com/index.php?route ... n_id=25071

Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...


User avatar
Active Member

Posts

Joined
Mon Nov 18, 2013 3:23 pm
Location - Oz

Post by allgoo » Mon Feb 22, 2016 1:33 pm

IP_CAM wrote:that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out... ;)
you got a 50/50 Chance, to get it for free! It should be worth that much... :D
Ernie
will try those for 1.5, am not confident they will do but you have a point 8)
artcore wrote:http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.
vincent_angbt wrote:
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');

and put this in:
date_default_timezone_set('America/Los_Angeles');

But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.
this gives me an error

Parse error: syntax error, unexpected '}' in /system/startup.php on line 29

Burt65 wrote:
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI

http://www.opencart.com/index.php?route ... n_id=25071
tried it but it didn't even show where it should :-\

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by vincent_angbt » Mon Feb 22, 2016 1:39 pm

allgoo wrote:
IP_CAM wrote:that should not be so critical, some of them match OC 1.5 and OC 2.x
I would JUST try it out... ;)
you got a 50/50 Chance, to get it for free! It should be worth that much... :D
Ernie
will try those for 1.5, am not confident they will do but you have a point 8)
artcore wrote:http://php.net/manual/en/timezones.php
You're not supposed to add the offset in that function, just the zone.
Add
date_default_timezone_set(YOUR ZONE IN QUOTES);
like
date_default_timezone_set('America/Los_Angeles');
to both your index.php's right after <?php on a new line.
vincent_angbt wrote:
Remove this on in system > startup.php:
if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');

and put this in:
date_default_timezone_set('America/Los_Angeles');

But you only will see report > customer activity is on the America/Los_Angeles, the rest remain unchange.
this gives me an error

Parse error: syntax error, unexpected '}' in /system/startup.php on line 29

Burt65 wrote:
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI

http://www.opencart.com/index.php?route ... n_id=25071
tried it but it didn't even show where it should :-\
i think you will give up this extension when you see this...

Attachments

ext.PNG

ext.PNG (38.21 KiB) Viewed 3003 times


New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by allgoo » Mon Feb 22, 2016 2:18 pm

Burt65 wrote:
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI

http://www.opencart.com/index.php?route ... n_id=25071
he changed it already :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id><![CDATA[Set Timezone for php and database]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver required="true"><![CDATA[2.5.0]]></vqmver>
	<author><![CDATA[Made Possible for Version 2.1.0.1 by Onnets - Original from Maulik Gandhi]]></author>
	
	<file name="admin/view/template/setting/setting.tpl">
		<operation error="log" info="">
			<search position="before" offset="1"><![CDATA[<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_maintenance; ?>"><?php echo $entry_maintenance; ?></span></label>]]></search>
			<add><![CDATA[
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-timezone">Timezone</label>
                <div class="col-sm-10">
<style type="text/css">
a.date{display:block;position:relative;width:80px;margin-bottom:18px;border:1px solid #888885;-moz-border-radius:5px;-webkit-border-radius:5px;font:24px/35px "Helvetica Neue",Arial,sans-serif;text-align:center;letter-spacing:2px;text-decoration:none;color:#666;background:#fcfcfc}
a.date sup{position:absolute;padding-top:25px;font-size:10px;line-height:10px;letter-spacing:normal}
a.date abbr{display:block;font:10px Verdana,sans-serif;letter-spacing:normal;color:#fff;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px}
a.date>:first-child{margin:-1px 0 0 -1px;padding:0 5px;border:1px solid #832a28;line-height:16px;text-align:left;text-transform:uppercase;background:#a33537}
a.date sup+abbr{position:absolute;top:0;left:0;width:72px;padding:0 3px;border:1px solid #a33537;border-bottom:1px solid #832a28;line-height:14px;color:#eaa;text-align:right}
a.date sub{display:block;height:20px;border-top:1px solid #bbd;margin:0 3px;color:#000;font:11px/16px Verdana,sans-serif;letter-spacing:normal;text-align:center}
</style>		
<?php
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
$timezone_options = "";
foreach ($timezones as $t) $timezone_options .= "<option value='$t' " . ($t == $config_timezone ? "selected" : "") . ">$t</option>";
$db_time = "Database time: " . $this->db->query("SELECT NOW() AS now")->row["now"];
$php_time = "PHP time:     " . date("Y-m-d H:i:s");
?>
				
                  <select name="config_timezone" id="input-timezone" class="form-control">
                    <option value="">Select</option><?php echo $timezone_options; ?>
                  </select><br>
				  <div><a class='date'><abbr><?php echo date('M'); ?></abbr> <?php echo date('d'); ?><sup>th</sup> <abbr><?php echo date('Y'); ?></abbr>
				  <sub><?php echo date('h:i:s A'); ?></sub></a></div>
				  <div><?php echo $php_time; ?></div>
				  <div><?php echo $db_time; ?></div>
                </div>
              </div>
      ]]></add>
		</operation>
	</file>
	
	<file name="system/startup.php">
		<operation error="log" info="">
			<search position="after"><![CDATA[require_once(DIR_SYSTEM . 'helper/utf8.php');]]></search>
			<add><![CDATA[

$db = new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE `key`='config_timezone'");
if ($query->num_rows) {
  $timezone = $query->fetch_assoc();
  if (!empty($timezone["value"])) date_default_timezone_set($timezone["value"]);
}
      ]]></add>
		</operation>
	</file>
	
	<file name="system/library/db.php">
		<operation error="log" info="">
			<search position="after"><![CDATA[public function query($sql) {]]></search>
			<add><![CDATA[
		$now = new DateTime();
		$mins = $now->getOffset() / 60;
		$sgn = ($mins < 0 ? -1 : 1);
		$mins = abs($mins);
		$hrs = floor($mins / 60);
		$mins -= $hrs * 60;
		$offset = sprintf('%+d:%02d', $hrs*$sgn, $mins);
		$this->db->query("SET time_zone='$offset'");
		
]]></add>
		</operation>
	</file>
</modification>

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by vincent_angbt » Mon Feb 22, 2016 2:28 pm

allgoo wrote:
Burt65 wrote:
allgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UI

http://www.opencart.com/index.php?route ... n_id=25071
he changed it already :

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
	<id><![CDATA[Set Timezone for php and database]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver required="true"><![CDATA[2.5.0]]></vqmver>
	<author><![CDATA[Made Possible for Version 2.1.0.1 by Onnets - Original from Maulik Gandhi]]></author>
	
	<file name="admin/view/template/setting/setting.tpl">
		<operation error="log" info="">
			<search position="before" offset="1"><![CDATA[<label class="col-sm-2 control-label"><span data-toggle="tooltip" title="<?php echo $help_maintenance; ?>"><?php echo $entry_maintenance; ?></span></label>]]></search>
			<add><![CDATA[
              <div class="form-group">
                <label class="col-sm-2 control-label" for="input-timezone">Timezone</label>
                <div class="col-sm-10">
<style type="text/css">
a.date{display:block;position:relative;width:80px;margin-bottom:18px;border:1px solid #888885;-moz-border-radius:5px;-webkit-border-radius:5px;font:24px/35px "Helvetica Neue",Arial,sans-serif;text-align:center;letter-spacing:2px;text-decoration:none;color:#666;background:#fcfcfc}
a.date sup{position:absolute;padding-top:25px;font-size:10px;line-height:10px;letter-spacing:normal}
a.date abbr{display:block;font:10px Verdana,sans-serif;letter-spacing:normal;color:#fff;-moz-border-radius-topright:5px;-webkit-border-top-right-radius:5px}
a.date>:first-child{margin:-1px 0 0 -1px;padding:0 5px;border:1px solid #832a28;line-height:16px;text-align:left;text-transform:uppercase;background:#a33537}
a.date sup+abbr{position:absolute;top:0;left:0;width:72px;padding:0 3px;border:1px solid #a33537;border-bottom:1px solid #832a28;line-height:14px;color:#eaa;text-align:right}
a.date sub{display:block;height:20px;border-top:1px solid #bbd;margin:0 3px;color:#000;font:11px/16px Verdana,sans-serif;letter-spacing:normal;text-align:center}
</style>		
<?php
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
$config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
$timezone_options = "";
foreach ($timezones as $t) $timezone_options .= "<option value='$t' " . ($t == $config_timezone ? "selected" : "") . ">$t</option>";
$db_time = "Database time: " . $this->db->query("SELECT NOW() AS now")->row["now"];
$php_time = "PHP time:     " . date("Y-m-d H:i:s");
?>
				
                  <select name="config_timezone" id="input-timezone" class="form-control">
                    <option value="">Select</option><?php echo $timezone_options; ?>
                  </select><br>
				  <div><a class='date'><abbr><?php echo date('M'); ?></abbr> <?php echo date('d'); ?><sup>th</sup> <abbr><?php echo date('Y'); ?></abbr>
				  <sub><?php echo date('h:i:s A'); ?></sub></a></div>
				  <div><?php echo $php_time; ?></div>
				  <div><?php echo $db_time; ?></div>
                </div>
              </div>
      ]]></add>
		</operation>
	</file>
	
	<file name="system/startup.php">
		<operation error="log" info="">
			<search position="after"><![CDATA[require_once(DIR_SYSTEM . 'helper/utf8.php');]]></search>
			<add><![CDATA[

$db = new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
$query = $db->query("SELECT * FROM " . DB_PREFIX . "setting WHERE `key`='config_timezone'");
if ($query->num_rows) {
  $timezone = $query->fetch_assoc();
  if (!empty($timezone["value"])) date_default_timezone_set($timezone["value"]);
}
      ]]></add>
		</operation>
	</file>
	
	<file name="system/library/db.php">
		<operation error="log" info="">
			<search position="after"><![CDATA[public function query($sql) {]]></search>
			<add><![CDATA[
		$now = new DateTime();
		$mins = $now->getOffset() / 60;
		$sgn = ($mins < 0 ? -1 : 1);
		$mins = abs($mins);
		$hrs = floor($mins / 60);
		$mins -= $hrs * 60;
		$offset = sprintf('%+d:%02d', $hrs*$sgn, $mins);
		$this->db->query("SET time_zone='$offset'");
		
]]></add>
		</operation>
	</file>
</modification>

New member

Posts

Joined
Tue Dec 17, 2013 11:35 am

Post by Burt65 » Mon Feb 22, 2016 2:53 pm

Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...

Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...


User avatar
Active Member

Posts

Joined
Mon Nov 18, 2013 3:23 pm
Location - Oz

Post by allgoo » Mon Feb 22, 2016 6:43 pm

Burt65 wrote:Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...

if it works fine with you then the problem has to be from my side , i changed the admin path and changed it in the code as well but it didn't work , can you share the file you have with me please

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by Burt65 » Mon Feb 22, 2016 7:17 pm

allgoo wrote:
Burt65 wrote:Yes I notice that... That's why I didn't bother to reply to him. But I'm using this extension in OC 2.1.0.2 and it works beautifully. And because it works on both DB and front end it also did fix my problem with countdown timer that use to go by the server time instead of my location time. That's why I suggested to you...

if it works fine with you then the problem has to be from my side , i changed the admin path and changed it in the code as well but it didn't work , can you share the file you have with me please
This thread is getting really confusing...

From the beginning...

OC 2.1.x.x everything original in startup.php, mysql.php mysqli.php and what ever other file you have modify.

Then use the extension mentioned above (the one for 2.1.x.x, that now is good) and set your timezone in Admin/setting/server/timezone.

That's it. That's all I did. That's all I know...

Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...


User avatar
Active Member

Posts

Joined
Mon Nov 18, 2013 3:23 pm
Location - Oz

Post by IP_CAM » Mon Feb 22, 2016 9:34 pm

AND MAKE SURE, to change in your config.php files from mysql to mysqli, because mysql won't work any longer with new Server PHP Versions !
define('DB_DRIVER', 'mysqli');

Ernie
openshop.li

My Github OC Site: https://github.com/IP-CAM
5'600 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by allgoo » Tue Feb 23, 2016 1:17 am

i did all what you guys mentioned but still it doesn't show where it should be ,, this is becoming so annoying ??? ???

Attachments

server.png

server.png (31.97 KiB) Viewed 2939 times


Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by allgoo » Tue Feb 23, 2016 12:44 pm

after reinstalling my vqmod i got this error in the server tab admin panel


HP Notice: Undefined property: Loader::$config in /vqmod/vqcache/vq2-system_storage_modification_admin_view_template_setting_setting.tpl on line 1397

Code: Select all

1396: $timezones = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
1397: $config_timezone = isset($this->request->post["config_timezone"]) ? $this->request->post["config_timezone"] : $this->config->get("config_timezone");
1398: $timezone_options = "";
any idea ?

Outstanding Сasual Dating


New member

Posts

Joined
Sat Nov 07, 2015 12:49 am
Location - GB

Post by thbr02 » Fri Apr 08, 2016 11:26 am

My host was updated to PHP 7 when the error appeared. When changing back to PHP 5.5 the time error disappeared.

When using burt65's extension I get this error:

Code: Select all

Undefined property: Loader::$config in /home/torshammar/domains/torshammarens.se/public_html/vqmod/vqcache/vq2-system_storage_modification_admin_view_template_setting_setting.tpl on line 1504

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden
Who is online

Users browsing this forum: No registered users and 63 guests