Jump to content
Sign in to follow this  
dr_lucas

Time Zone Offset Contribution Support

Recommended Posts

This is the support thread

Share this post


Link to post
Share on other sites

Contribution location:

http://www.oscommerce.com/community/contributions,4156

 

WHAT DOES THIS MODULE DO?

 

This module allows you to set a time zone offset into the cart if you are in a situation where your store is in a different time zone from the server on which it is hosted. (For example, your store is based in Australia but is hosted on a server in the USA.) This situation can become a problem for accounting because order dates will not be accurate for the store time zone.

The module will also make the entire store and admin display the right date and time of your real location.

 

The module inserts a new configuration key into the database that sets the value of the time zone difference. The offset value is set from Admin>Configuration>My Store>Time Zone Offset.

 

All orders will have their 'date_purchased' value corrected for the timezone difference when they are inserted into the database. This corrected value will be displayed on all admin pages, on the customer's 'My Account' page

 

Need to work on: Make it display the right date in order confirmation and order status update emails (code is located in checkout_process.php). I couldn't do that. Any help will be appreciated.

Share this post


Link to post
Share on other sites
Contribution location:

http://www.oscommerce.com/community/contributions,4156

 

WHAT DOES THIS MODULE DO?

 

This module allows you to set a time zone offset into the cart if you are in a situation where your store is in a different time zone from the server on which it is hosted. (For example, your store is based in Australia but is hosted on a server in the USA.) This situation can become a problem for accounting because order dates will not be accurate for the store time zone.

The module will also make the entire store and admin display the right date and time of your real location.

 

The module inserts a new configuration key into the database that sets the value of the time zone difference. The offset value is set from Admin>Configuration>My Store>Time Zone Offset.

 

All orders will have their 'date_purchased' value corrected for the timezone difference when they are inserted into the database. This corrected value will be displayed on all admin pages, on the customer's 'My Account' page

 

Need to work on: Make it display the right date in order confirmation and order status update emails (code is located in checkout_process.php). I couldn't do that. Any help will be appreciated.

Hello,

 

I've just installed the contribution. I was looking for this for a long time and finally found it. Unfortunately, it doesn't work for me, although I followed all the steps in the instructions. Time doesn't change. Is there anything wrong or I'm missing something? Any help would be appreciated.

 

Thanks in advance,

Irina.

Share this post


Link to post
Share on other sites
Hello,

 

I've just installed the contribution. I was looking for this for a long time and finally found it. Unfortunately, it doesn't work for me, although I followed all the steps in the instructions. Time doesn't change. Is there anything wrong or I'm missing something? Any help would be appreciated.

 

Thanks in advance,

Irina.

 

Hi, Irin

I thought it may be something with my heavily modded store that made it work for me, so I just tried my own mod on a brand new installation of osC, following my own instructions, and all seem to be working as it should. Could you please provide some more information? Does the time of your store change at all? Does the time/date of your newly placed order change? Did you set the offset in the admin My Store configuration to match your time(I set it to +14 on my store because I am located in BKK while my host is in California) ? Did you set the correct TZ settings in your english.php files?

Please check all the steps out again and let me know....

Anyone else tried it and did have success?

Share this post


Link to post
Share on other sites
Hi, Irin

I thought it may be something with my heavily modded store that made it work for me, so I just tried my own mod on a brand new installation of osC, following my own instructions, and all seem to be working as it should. Could you please provide some more information? Does the time of your store change at all? Does the time/date of your newly placed order change? Did you set the offset in the admin My Store configuration to match your time(I set it to +14 on my store because I am located in BKK while my host is in California) ? Did you set the correct TZ settings in your english.php files?

Please check all the steps out again and let me know....

Anyone else tried it and did have success?

Hi dr_lucas. The time doesn't change at all, it's the same as it was before I installed the contrib. The server's time is Pacific when I want it to be Central. For example, now in my Server Info it's 'Datebase Date: 04/09/2006 17:49:45' and it suppose to be 'Datebase Date: 04/09/2006 19:49:45'. I set the offset to +2 in My Store configuration. In my english.php, I changed @setlocale(LC_TIME, 'en_US.ISO_8859-1'); to

@setlocale(LC_TIME, 'en_US.ISO_8859-1');

putenv("TZ=USA/Houston");

$lcl_date_time = date("Y-m-d H:i:s");

I tried different settings for TZ, but it seems not picking it up at all, because I see no change in the time offset. I did everything exactly according your instructions, but it doesn't change the time. What else can be wrong? Any other ideas?

 

Thanks for your help.

Share this post


Link to post
Share on other sites

Irina, first try to place a new order and see if the order date and time match your Houston time after you installed the mod. Does it show the right time now?

After that, just for testing purposes try to change the

putenv("TZ=USA/Houston");

to

putenv("TZ=Asia/Bangkok");

in both your catalog/includes/languages/english.php and admin/includes/languages/english.php and check if your store time changes. If it doesn't, it may be (although I am not 100% sure) because your host disables the putenv command on the server, but the orders still supposed to show the right time because they do not use the putenv addition...

Share this post


Link to post
Share on other sites

By the way, I believe your TZ should be set to:

putenv("TZ=US/Pacific");

some Unix servers may use a different format for TZ. Example: putenv("TZ=PST8EDT");

Edited by dr_lucas

Share this post


Link to post
Share on other sites
By the way, I believe your TZ should be set to:

putenv("TZ=US/Pacific");

some Unix servers may use a different format for TZ. Example: putenv("TZ=PST8EDT");

I was playing around with the code and I picked up that when I'm in the admin/Server Info, I have

Server Date: 04/10/2006 04:10:46

Datebase Date: 04/09/2006 20:10:46

So, the contribution adds 8 extra hours to the original server's time. It seems that even if I change the time offset in my admin configuration, it doesn't change the time. However, the code in admin/includes/languages/english.php plays important role, so I guess I need to play with it. Right now in my english.php I have:
setlocale(LC_TIME, 'en_US.ISO_8859-1');

putenv("TZ=US/Central");

$lcl_date_time = date("Y-m-d H:i:s");

Changing TZ alone also doesn't change the time. Any ideas?

By the way, I'm on Windows server.

Edited by Irin

Share this post


Link to post
Share on other sites

Irina,

1) I am not sure if this will work on Windows servers, I never tested it on a windows server. I am also not sure if your host allow putenv, this should be checked as well.

2) The code in admin/includes/languages/english.php has got nothing to do with the offset time you set in Admin. The only files which are using this variable are the database.php files (TIME_ZONE_OFFSET). My mod is actually 2 separate time-zone mods in 1...

3) Did you place an order in your store to check the order date and time? Does it show the right time after you set the offset right?

Share this post


Link to post
Share on other sites
Irina,

1) I am not sure if this will work on Windows servers, I never tested it on a windows server. I am also not sure if your host allow putenv, this should be checked as well.

2) The code in admin/includes/languages/english.php has got nothing to do with the offset time you set in Admin. The only files which are using this variable are the database.php files (TIME_ZONE_OFFSET). My mod is actually 2 separate time-zone mods in 1...

3) Did you place an order in your store to check the order date and time? Does it show the right time after you set the offset right?

I just placed an order through my store. In admin/orders in Date Purchased it shows 04/09/2006 23:44:00, which is correct for my time zone, although when I click on Invoice in either admin or catalog sides, it shows that order was placed on 04/10/2006 which is the same as it shows in admin/server info. What does it mean?

Share this post


Link to post
Share on other sites
I just placed an order through my store. In admin/orders in Date Purchased it shows 04/09/2006 23:44:00, which is correct for my time zone, although when I click on Invoice in either admin or catalog sides, it shows that order was placed on 04/10/2006 which is the same as it shows in admin/server info. What does it mean?

Sorry, I forgot to mention that when email is sent, it also says that 'Date of Order: Apr 10, 2006' though it's just Apr 9, 2006.

Share this post


Link to post
Share on other sites

The problem must be in your admin/includes/languages/english.php

Your server date and time in the Admin "Server info" is taken from this file so you will probably have to play more with the

putenv("TZ=US/Central");

until it shows you the right time and date in the server date line.

I am sure that if you remove the 2 lines from admin/includes/languages/english.php:

putenv("TZ=US/Central");

$lcl_date_time = date("Y-m-d H:i:s");

 

then the server date & time will be as before, matching the datebase date...

 

Once you find the correct TZ that adjust the server date to match yours, you will have to put it in both the english.php files of course.

Share this post


Link to post
Share on other sites
The problem must be in your admin/includes/languages/english.php

Your server date and time in the Admin "Server info" is taken from this file so you will probably have to play more with the

putenv("TZ=US/Central");

until it shows you the right time and date in the server date line.

I am sure that if you remove the 2 lines from admin/includes/languages/english.php:

putenv("TZ=US/Central");

$lcl_date_time = date("Y-m-d H:i:s");

 

then the server date & time will be as before, matching the datebase date...

 

Once you find the correct TZ that adjust the server date to match yours, you will have to put it in both the english.php files of course.

I think I found how to change the time zone on my server. Now in my admin/server info I have: Server Date: 04/10/2006 17:40:26 Datebase Date: 04/10/2006 15:40:26. Here is how I modified my code in both admin and catalog sides:

@setlocale(LC_TIME, 'en_US.ISO_8859-1');

putenv ("TZ=CST5");

$lcl_date_time = date("Y-m-d H:i:s");

I'm not sure this is the right way, but it works for me so far except for the "Visitors" contribution, it's still showing visits in Pacific time not Central. And, the TIME_ZONE_OFFSET in admin/configuration doesn't work. It doesn't matter what time offset I'd specify, it doesn't change anything. Is there anything we can do about it?

 

Regards,

Irin.

Share this post


Link to post
Share on other sites
And, the TIME_ZONE_OFFSET in admin/configuration doesn't work. It doesn't matter what time offset I'd specify, it doesn't change anything. Is there anything we can do about it?

 

Actually, it does change something as you stated before - it changed the time and date of your received orders, which is what its supposed to change. Without it your orders time and date will be the same as your datebase's...

Share this post


Link to post
Share on other sites
...except for the "Visitors" contribution, it's still showing visits in Pacific time not Central.

 

You are right about that, it's the same on my system, with the old mod, and it's because its' code isn't standard osCommerce code. It also does not use the now() function, and that is why the time and date are showing in PST instead of Central. I am also using the excellent user tracking contribution (http://www.oscommerce.com/community/contributions,1055) and it works fine there simply because it's written according to osC standards...

 

You may want to replace your visitors mod with the updated one:

http://www.oscommerce.com/community/contributions,4067

Edited by dr_lucas

Share this post


Link to post
Share on other sites
You are right about that, it's the same on my system, with the old mod, and it's because its' code isn't standard osCommerce code. It also does not use the now() function, and that is why the time and date are showing in PST instead of Central. I am also using the excellent user tracking contribution (http://www.oscommerce.com/community/contributions,1055) and it works fine there simply because it's written according to osC standards...

 

You may want to replace your visitors mod with the updated one:

http://www.oscommerce.com/community/contributions,4067

This is exactly what I'm using right now, http://www.oscommerce.com/community/contributions,4067. And, as I said, the the time is still showing in PST instead of CST.

Edited by Irin

Share this post


Link to post
Share on other sites
This is exactly what I'm using right now, http://www.oscommerce.com/community/contributions,4067. And, as I said the, the time is still showing in PST instead of CST.

 

Regards.

 

So they probably still didn't revise the new mod to work with the now() function. They should have...

In this case, the only advice I could offer you is "use sunscreen" (j/k) ;)

Seriously now - there is not much you can do for this visitors script at the moment, at least all the rest is working as it should. :)

Share this post


Link to post
Share on other sites
The problem must be in your admin/includes/languages/english.php

Your server date and time in the Admin "Server info" is taken from this file so you will probably have to play more with the

putenv("TZ=US/Central");

until it shows you the right time and date in the server date line.

I am sure that if you remove the 2 lines from admin/includes/languages/english.php:

putenv("TZ=US/Central");

$lcl_date_time = date("Y-m-d H:i:s");

 

then the server date & time will be as before, matching the datebase date...

 

Once you find the correct TZ that adjust the server date to match yours, you will have to put it in both the english.php files of course.

I found this site to be useful http://www.timeanddate.com/library/abbreviations/timezones/


--- Denver Prophit Jr.

Share this post


Link to post
Share on other sites

The complete list of supported time zones can be found here:

http://us3.php.net/manual/en/timezones.php

Edited by dr_lucas

Share this post


Link to post
Share on other sites

Guys I am completely confused with this timezone patch.

I have added it

now when I add products (in categories) it says this :

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'date_add(now(), INTERVAL -h,4 HOUR) where products_id = '1579''

 

update products set products_quantity = '50', products_model = '0340220016', products_price = '49.9500', products_date_available = null, products_weight = '0.00', products_status = '1', products_tax_class_id = '1', manufacturers_id = '', products_image = 'test.jpg', date_add(now(), INTERVAL -h,4 HOUR) where products_id = '1579'

 

[TEP STOP]

 

what is the problem with my sql? and how do i fix it

 

look forward to your reply

Share this post


Link to post
Share on other sites
Guys I am completely confused with this timezone patch.

I have added it

now when I add products (in categories) it says this :

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'date_add(now(), INTERVAL -h,4 HOUR) where products_id = '1579''

 

update products set products_quantity = '50', products_model = '0340220016', products_price = '49.9500', products_date_available = null, products_weight = '0.00', products_status = '1', products_tax_class_id = '1', manufacturers_id = '', products_image = 'test.jpg', date_add(now(), INTERVAL -h,4 HOUR) where products_id = '1579'

 

[TEP STOP]

 

what is the problem with my sql? and how do i fix it

 

look forward to your reply

 

This info is insufficient. Please copy & paste here the complete content of the following files:

catalog/includes/functions/database.php

catalog/admin/includes/functions/database.php

Share this post


Link to post
Share on other sites
This info is insufficient. Please copy & paste here the complete content of the following files:

catalog/includes/functions/database.php

catalog/admin/includes/functions/database.php

catalog/includes/functions/database.php

 

<?php

/*

$Id: database.php,v 1.21 2003/06/09 21:21:59 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

global $$link;

 

if (USE_PCONNECT == 'true') {

$$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

if ($$link) mysql_select_db($database);

 

return $$link;

}

 

function tep_db_close($link = 'db_link') {

global $$link;

 

return mysql_close($$link);

}

 

function tep_db_error($query, $errno, $error) {

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

function tep_db_query($query, $link = 'db_link') {

global $$link;

 

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);

}

 

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

 

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

$result_error = mysql_error();

error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);

}

 

return $result;

}

 

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

reset($data);

if ($action == 'insert') {

$query = 'insert into ' . $table . ' (';

while (list($columns, ) = each($data)) {

$query .= $columns . ', ';

}

$query = substr($query, 0, -2) . ') values (';

reset($data);

while (list(, $value) = each($data)) {

switch ((string)$value) {

case 'now()':

// Added a time offset function here

$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';

break;

case 'null':

$query .= 'null, ';

break;

default:

$query .= '\'' . tep_db_input($value) . '\', ';

break;

}

}

$query = substr($query, 0, -2) . ')';

} elseif ($action == 'update') {

$query = 'update ' . $table . ' set ';

while (list($columns, $value) = each($data)) {

switch ((string)$value) {

case 'now()':

// Added a time offset function here

$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';

break;

case 'null':

$query .= $columns .= ' = null, ';

break;

default:

$query .= $columns . ' = \'' . tep_db_input($value) . '\', ';

break;

}

}

$query = substr($query, 0, -2) . ' where ' . $parameters;

}

 

return tep_db_query($query, $link);

}

 

function tep_db_fetch_array($db_query) {

return mysql_fetch_array($db_query, MYSQL_ASSOC);

}

 

function tep_db_num_rows($db_query) {

return mysql_num_rows($db_query);

}

 

function tep_db_data_seek($db_query, $row_number) {

return mysql_data_seek($db_query, $row_number);

}

 

function tep_db_insert_id() {

return mysql_insert_id();

}

 

function tep_db_free_result($db_query) {

return mysql_free_result($db_query);

}

 

function tep_db_fetch_fields($db_query) {

return mysql_fetch_field($db_query);

}

 

function tep_db_output($string) {

return htmlspecialchars($string);

}

 

function tep_db_input($string) {

return addslashes($string);

}

 

function tep_db_prepare_input($string) {

if (is_string($string)) {

return trim(tep_sanitize_string(stripslashes($string)));

} elseif (is_array($string)) {

reset($string);

while (list($key, $value) = each($string)) {

$string[$key] = tep_db_prepare_input($value);

}

return $string;

} else {

return $string;

}

}

?>

Share this post


Link to post
Share on other sites

and

catalog/admin/includes/functions/database.php

 

<?php

/*

$Id: database.php,v 1.23 2003/06/20 00:18:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') {

global $$link;

 

if (USE_PCONNECT == 'true') {

$$link = mysql_pconnect($server, $username, $password);

} else {

$$link = mysql_connect($server, $username, $password);

}

 

if ($$link) mysql_select_db($database);

 

return $$link;

}

 

function tep_db_close($link = 'db_link') {

global $$link;

 

return mysql_close($$link);

}

 

function tep_db_error($query, $errno, $error) {

die('<font color="#000000"><b>' . $errno . ' - ' . $error . '<br><br>' . $query . '<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>');

}

 

function tep_db_query($query, $link = 'db_link') {

global $$link, $logger;

 

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

if (!is_object($logger)) $logger = new logger;

$logger->write($query, 'QUERY');

}

 

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

 

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {

if (mysql_error()) $logger->write(mysql_error(), 'ERROR');

}

 

return $result;

}

 

function tep_db_perform($table, $data, $action = 'insert', $parameters = '', $link = 'db_link') {

reset($data);

if ($action == 'insert') {

$query = 'insert into ' . $table . ' (';

while (list($columns, ) = each($data)) {

$query .= $columns . ', ';

}

$query = substr($query, 0, -2) . ') values (';

reset($data);

while (list(, $value) = each($data)) {

switch ((string)$value) {

case 'now()':

// Added a time offset function here

$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';

break;

case 'null':

$query .= 'null, ';

break;

default:

$query .= '\'' . tep_db_input($value) . '\', ';

break;

}

}

$query = substr($query, 0, -2) . ')';

} elseif ($action == 'update') {

$query = 'update ' . $table . ' set ';

while (list($columns, $value) = each($data)) {

switch ((string)$value) {

case 'now()':

// Added a time offset function here

$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';

break;

case 'null':

$query .= $columns .= ' = null, ';

break;

default:

$query .= $columns . ' = \'' . tep_db_input($value) . '\', ';

break;

}

}

$query = substr($query, 0, -2) . ' where ' . $parameters;

}

 

return tep_db_query($query, $link);

}

 

function tep_db_fetch_array($db_query) {

return mysql_fetch_array($db_query, MYSQL_ASSOC);

}

 

function tep_db_result($result, $row, $field = '') {

return mysql_result($result, $row, $field);

}

 

function tep_db_num_rows($db_query) {

return mysql_num_rows($db_query);

}

 

function tep_db_data_seek($db_query, $row_number) {

return mysql_data_seek($db_query, $row_number);

}

 

function tep_db_insert_id() {

return mysql_insert_id();

}

 

function tep_db_free_result($db_query) {

return mysql_free_result($db_query);

}

 

function tep_db_fetch_fields($db_query) {

return mysql_fetch_field($db_query);

}

 

function tep_db_output($string) {

return htmlspecialchars($string);

}

 

function tep_db_input($string) {

return addslashes($string);

}

 

function tep_db_prepare_input($string) {

if (is_string($string)) {

return trim(stripslashes($string));

} elseif (is_array($string)) {

reset($string);

while (list($key, $value) = each($string)) {

$string[$key] = tep_db_prepare_input($value);

}

return $string;

} else {

return $string;

}

}

?>

Share this post


Link to post
Share on other sites

this also happens when a customer wants to buy a product,

they click on confirm order

and it comes up with this :

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '), '2102', 'AUD', '1.00000000')' at line 1

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values ('36', 'greg burridge', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '61407282810', 'support@onestopadultshop.com', '1', 'greg test', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '1', 'greg test', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '1', 'Bank Transfer Payment', '', '', '', '', date_add(now(), INTERVAL HOUR), '2102', 'AUD', '1.00000000')

 

[TEP STOP]

 

 

no idea whats going on

Share this post


Link to post
Share on other sites
this also happens when a customer wants to buy a product,

they click on confirm order

and it comes up with this :

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '), '2102', 'AUD', '1.00000000')' at line 1

 

insert into orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values ('36', 'greg burridge', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '61407282810', 'support@onestopadultshop.com', '1', 'greg test', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '1', 'greg test', '', '7 test rd', '', 'brisbane', '4000', '', 'Australia', '1', 'Bank Transfer Payment', '', '', '', '', date_add(now(), INTERVAL HOUR), '2102', 'AUD', '1.00000000')

 

[TEP STOP]

 

 

no idea whats going on

 

It happens because you revised the now() function twice in your php files instead of only once in each file...

You should have revised only the first now() case...

It should be changed back to the original:

	  while (list(, $value) = each($data)) {
	switch ((string)$value) {
	   case 'now()':
// Added a time offset function here
		$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';
		break;
	  case 'null':
		$query .= 'null, ';
		break;
	  default:
		$query .= '\'' . tep_db_input($value) . '\', ';
		break;
	}
  }
  $query = substr($query, 0, -2) . ')';
} elseif ($action == 'update') {
  $query = 'update ' . $table . ' set ';
  while (list($columns, $value) = each($data)) {
	switch ((string)$value) {

****************************************************CHANGE IT BACK BELOW: (In both files)
case 'now()':
// Added a time offset function here
		$query .= 'date_add(now(), INTERVAL ' . TIME_ZONE_OFFSET . ' HOUR), ';
		break;
	  case 'null':
		$query .= $columns .= ' = null, ';
		break;

Edited by dr_lucas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×