URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushp_general_purpose
Thread Number: 373
[ Go back to previous page ]

Original Message
"order number"

Posted by M Ulm [monteulm@hotmail.com] on at 12:35 PM
I would like to shorten the date part of the order number to just ddmmy with the y being the last digit of the year. I would also like to remove the "-" from the middle.
Thanks

Table of contents

Messages in this discussion
"RE: order number"
Posted by Bill Weiner on at 04:01 AM
To change the format of the date used for the order number to the format that you describe, here are some steps to customize the uShop CGI script:

STEP 1: Make a backup of your current ushop-lib.pl script... just in case.

STEP 2: Open your ushop-lib.pl script with any text editor such as WordPad.

STEP 3: Do a search on the following line:

if ($order_number_format == 0)

STEP 4: Change that section of code from:

if ($order_number_format == 0)
{
$order_number = sprintf("%09d",$random_number);
}
elsif ($order_number_format == 1)
{
$order_number = sprintf("%02d%02d%04d-%09d",$mon,$mday,$year,$random_number);
}
else
{
$order_number = sprintf("%02d%02d%04d-%09d",$mday,$mon,$year,$random_number);
}

To:

$year = $year - 2000;
if ($order_number_format == 0)
{
$order_number = sprintf("%09d",$random_number);
}
elsif ($order_number_format == 1)
{
$order_number = sprintf("%02d%02d%d%09d",$mon,$mday,$year,$random_number);
}
else
{
$order_number = sprintf("%02d%02d%d%09d",$mday,$mon,$year,$random_number);
}

(You basically add the "$year = $year - 2000;" line and change two "sprintf" lines.)

STEP 5: Save the script... as TEXT if your editor asks... and try it out!


"RE: order number"
Posted by Joe Banks [joe@waponiwoo.com] on at 11:04 PM

> (You basically add the "$year = $year - 2000;" line and change two "sprintf" lines.)

HMM- IS THIS Y3K COMPLIANT?


"RE: order number"
Posted by Bill Weiner on at 06:31 AM
Given that this is only to achieve the format that he wants for the order number (ddmmy), it's not critical. But he can deal with that when Y3K comes around :^)