|Date and Time|
|Date and Time|
Author ronharter on 05-13-2000 at 16:17 (EST)
|Is there a way to add the date and time or at least the date to an order? This should be done automatically not so the customer has to add it.|
I maintain two sites that use Ushop
|Messages In This Discussion|
| 1. date|
Author Charlie Edmunds on 05-13-2000 at 20:18 (EST)
Thanks, Charlie Edmunds
| 2. RE: Date and Time|
Author Bill Weiner on 05-18-2000 at 06:34 (EST)
|Note that right now, the date can be attained by looking at the time/date of the email receipt / email notification.|
However, if you want to actually add the date to the order file, then that is not configurable at this time, but we will be adding that feature to the next release.
In the mean time, however, if you feel comfortable about editing Perl scripts, then you can make the following changes to the ushop_cgiscript to insert the date for you:
1) Open the ushop_cgiscript.pl file with any text editor such as WordPad.
2) Do a search on "sub write_data"...this will get you to the first line of the "write data" subroutine.
3) Directly after the line:
local ($file_name, $order_data) = @_;
Add the following lines to define some new local variables:
# Define local variables.
4) Below those lines, add the following lines to get the current time/date:
# Get the date and time.
$isdst) = localtime();
5) Below those lines, add the following lines to correct the Y2K date problem that exists on some servers:
# Y2K FIX - Because some servers
# return the year 2000 as 100
# instead of 00.
if ($year > 99)
$year = $year - 100;
6) Below those lines, add the following lines to format the date:
7) And finally, write this formatted date to the file by adding the following line directly BEFORE the line that says:
# Write the data to the file.
That is, add this line:
print FILE $formatted_date . "n";
8) Save the file and try it out.
| 3. Date and Time|
Author ronharter on 05-20-2000 at 22:09 (EST)
|Thanks a lot.|
The script patch worked just fine.
| 4. Date and Time|
Author ronharter on 05-21-2000 at 09:55 (EST)
|The date and time additions to the cgi script work fine except there is a minor error in one of the lines.|
The line that says:
The fourth % was left out and it will actually print 02d as the hour without it.
Other than that it worked really well, and my boss is even happier than I am.