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
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.
The first 3 listed are freeallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
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
not for oc 2.1.0.2EvolveWebHosting wrote:The first 3 listed are freeallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
I would JUST try it out...

you got a 50/50 Chance, to get it for free! It should be worth that much...

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.
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+
Thanks!
Remove this on in system > startup.php: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
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.
I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UIallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
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...
will try those for 1.5, am not confident they will do but you have a pointIP_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...![]()
Ernie

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.
this gives me an errorvincent_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.
Parse error: syntax error, unexpected '}' in /system/startup.php on line 29
tried it but it didn't even show where it shouldBurt65 wrote:I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UIallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
http://www.opencart.com/index.php?route ... n_id=25071

i think you will give up this extension when you see this...allgoo wrote:will try those for 1.5, am not confident they will do but you have a pointIP_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...![]()
Ernie![]()
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.this gives me an errorvincent_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.
Parse error: syntax error, unexpected '}' in /system/startup.php on line 29
tried it but it didn't even show where it shouldBurt65 wrote:I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UIallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
http://www.opencart.com/index.php?route ... n_id=25071
Attachments
ext.PNG (38.21 KiB) Viewed 3005 times
he changed it already :Burt65 wrote:I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UIallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
http://www.opencart.com/index.php?route ... n_id=25071
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>
allgoo wrote:he changed it already :Burt65 wrote:I think you will find this extension will please you, as if fix all timezone problems and it comes with a beautiful UIallgoo wrote:i was hoping to find a free solution for it , but now i think i have other thoughts, thanks
http://www.opencart.com/index.php?route ... n_id=25071
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>
Over 95% of all computer problems can be traced back to the interface between the keyboard and the chair...
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...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
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...
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.


Attachments
server.png (31.97 KiB) Viewed 2941 times
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 = "";
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
Users browsing this forum: No registered users and 110 guests