Page 1 of 1
Displayed purchased time on admin/orders.php
Posted: Tue Mar 29, 2022 7:28 pm
by BPickle
admin/orders.php displays the purchase date and time according to the time zone that the server is set to.
Is there a way to adjust the displayed date and time to make it display according to the time zone of the store owner?
Re: Displayed purchased time on admin/orders.php
Posted: Wed Mar 30, 2022 3:57 pm
by edfaught
I believe you just need to set date.timezone in your php.ini file.
Re: Displayed purchased time on admin/orders.php
Posted: Wed Mar 30, 2022 4:30 pm
by heatherbell
Just guessing but could this be done by changing in configure files?
e.g.
change
Code: Select all
date_default_timezone_set(date_default_timezone_get());
to
Code: Select all
date_default_timezone_set('America/Los_Angeles');
Re: Displayed purchased time on admin/orders.php
Posted: Wed Mar 30, 2022 4:40 pm
by BPickle
edfaught wrote: ↑Wed Mar 30, 2022 3:57 pm
I believe you just need to set date.timezone in your php.ini file.
I just tried that, and it results in a 500 internal server configuration error.
Re: Displayed purchased time on admin/orders.php
Posted: Wed Mar 30, 2022 5:02 pm
by BPickle
heatherbell wrote: ↑Wed Mar 30, 2022 4:30 pm
Just guessing but could this be done by changing in configure files?
e.g.
change
Code: Select all
date_default_timezone_set(date_default_timezone_get());
to
Code: Select all
date_default_timezone_set('America/Los_Angeles');
Thanks for the suggestions. Whether I put your suggested code in configure.php or in orders.php, a test order's email notifications have the correct time on them whether your suggested code is added or not, but the dates generated by orders.php are an hour off whether your suggested code is added or not.
I think the issue is how the date and time are stored in the database, and whether the existing Phoenix code does any manipulation of the time values retrieved from the database. If there is no manipulation of the stored values, I think it's going to be off when the store is not in the same time zone as the server.
If in admin/includes/actions/orders/views/default.php I change
to
Code: Select all
return date('Y-m-d H:i:s', strtotime($row['date_purchased']) - 3600);
that fixes the issue in one spot. But being able to set the timezone in one location and have that setting affect the entire catalog would be a better solution, I think.