Displayed purchased time on admin/orders.php

Ask the community for help and support.
Post Reply
BPickle
Posts: 20
Joined: Tue Apr 06, 2021 2:08 pm
Been thanked: 4 times

Displayed purchased time on admin/orders.php

Post 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?
User avatar
edfaught
Posts: 49
Joined: Mon Oct 26, 2020 3:22 pm
Has thanked: 4 times
Been thanked: 2 times

Re: Displayed purchased time on admin/orders.php

Post by edfaught »

I believe you just need to set date.timezone in your php.ini file.
heatherbell
VIP Member
VIP Member
Posts: 1996
Joined: Mon Oct 07, 2019 4:39 am
Has thanked: 26 times
Been thanked: 175 times

Re: Displayed purchased time on admin/orders.php

Post 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');
BPickle
Posts: 20
Joined: Tue Apr 06, 2021 2:08 pm
Been thanked: 4 times

Re: Displayed purchased time on admin/orders.php

Post 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.
BPickle
Posts: 20
Joined: Tue Apr 06, 2021 2:08 pm
Been thanked: 4 times

Re: Displayed purchased time on admin/orders.php

Post 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

Code: Select all

return $row['date_purchased'];
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.
Post Reply