Page 1 of 2
Add time to orders
Posted: Wed Sep 14, 2011 8:56 pm
by samwise
Hi all,
I would like to display the time the order was placed next to the date, in the Sales->Orders page in the admin section.
Is there already a variable for time that I can call?
Cheers,
Sam
Re: Add time to orders
Posted: Thu Sep 15, 2011 7:13 pm
by uksitebuilder
open: admin/controller/sale/order.php
find:
Code: Select all
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
change to:
Code: Select all
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])).' '.date($this->language->get('time_format'), strtotime($result['date_added'])),
Re: Add time to orders
Posted: Sun Oct 16, 2011 12:59 pm
by joy
uksitebuilder wrote:open: admin/controller/sale/order.php
find:
Code: Select all
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
......
Kudos to you!
However, my server time and my local time is having a 15 hours difference. How can I make it to show the time in my local timezone?
I read the post about Setting Local Timezone values in database. I am not sure if I get the meaning wrong but I do not want to change the time in the MySQL database (what if I decided to change the host, and the server is at another time zone again, and that will mess up the time recorded... btw, i haven't check if the database recorded the time in unix timestamp).
I just want to have the local time display on the webpage, which probably is as stated in this post.
Someone did this, and I read this blog post too regarding the changes needed to show the local date for specials and discounts feature.
I don't know which approach is the best. Probably you can give suggestions and solutions on this if it is not too much of works.
Thank you in advance.
----------------------------
Edit to add:
Never mind, I decided to use the method showing in Setting Local Timezone values in database.
Re: Add time to orders
Posted: Sun Oct 16, 2011 5:20 pm
by markman-b
uksitebuilder wrote:open: admin/controller/sale/order.php
change to:
Code: Select all
'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])).' '.date($this->language->get('time_format'), strtotime($result['date_added'])),
Thanx, useful modification!
How does the string look like for an 24 hour notation?
Re: Add time to orders
Posted: Mon Oct 17, 2011 10:12 pm
by joy
markman-b wrote:
How does the string look like for an 24 hour notation?
You can change the format at admin/language/english/english.php
e.g. From h:i:s A = 08:05:13 PM to H:i:s = 20:05:13
change:
to:
Re: Add time to orders
Posted: Tue Oct 18, 2011 8:04 pm
by markman-b
Thanx joy!
Re: Add time to orders
Posted: Tue Oct 18, 2011 9:39 pm
by markman-b
Hi guys,
Changing the the time format in the admin language files, does not convert the time into a 24 hour format.
It still shows the time in an 12 hour format, but without AM/PM.
I assume this modification had to be done in the admin/conroller/sale/order.php file, isn't it?
Please tell me how.
kind regards
Markman-B
Re: Add time to orders
Posted: Tue Oct 18, 2011 9:49 pm
by joy
markman-b wrote:
It still shows the time in an 12 hour format, but without AM/PM.
Are you sure you typed "
H"?
Because H is for 00~23, h is for 01~12. Please refer to
the manual here.
This post here is another approach of changing the date & time format wherever you want.
Re: Add time to orders
Posted: Tue Oct 18, 2011 9:56 pm
by markman-b
That capital H did the trick! I completely overlooked it.
Thnx mate.
Re: Add time to orders
Posted: Tue Oct 18, 2011 9:59 pm
by joy
You are welcome!
Re: Add time to orders
Posted: Thu Nov 10, 2011 8:51 pm
by olstar
Awesome..
Worked like a charm!
Re: Add time to orders
Posted: Fri Nov 18, 2011 6:52 pm
by jannoi
Hello guys,
This was really useful for my shop.
But is there a way to show the time also in the Dashboard?
Re: Add time to orders
Posted: Tue Nov 29, 2011 12:02 am
by olstar
Do the same edit on the file used to show the dash
Re: Add time to orders
Posted: Wed Dec 28, 2011 10:11 pm
by MvQ
THANKS! I really love this forum. SOOOO helpful!!
Worked like a charm..
Re: Add time to orders
Posted: Tue Jan 03, 2012 6:06 pm
by mmkvn
Thank you for the useful modification.
However, I have an issue related to time: By default, from the control panel in admin we can only set period by choosing a starting date and an ending date from a calendar drop-down (e.g: special discount period). How can I input a date WITH TIME (for example: 2011-12-13 10:06:49) in the control panel? This is important for my shop.
Thanks in advance
Re: Add time to orders
Posted: Tue Apr 24, 2012 5:00 pm
by Ozfarmer
Thanks UK Brilliant!
Re: Add time to orders
Posted: Fri Mar 22, 2013 6:27 pm
by MikeSCC
Thanks for this.
Re: Add time to orders
Posted: Sun Jan 26, 2014 10:51 pm
by venkatesh1993
This works great, but how do I add the time on the Print Page ?
I tried to add the same time code, but it shows 00:00
Re: Add time to orders
Posted: Tue Jan 28, 2014 12:04 am
by venkatesh1993
Anyone please ?
Re: Add time to orders
Posted: Tue Jan 28, 2014 12:13 am
by nvedia
venkatesh1993 wrote:This works great, but how do I add the time on the Print Page ?
I tried to add the same time code, but it shows 00:00
What do you mean by Print Page?
Print Order?
Which file did you try to edit?