Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New style order number...help needed pls


billybrag

Recommended Posts

I would like to change the order number from what it is now to what i show below....

 

ie now the orders are simply numbers ie

1, 2, 3, ........5789 etc

 

i would like to add a prefix and make the number 4 digit, ie

MT0001, MT0002, MT003, .............MT5789

 

 

any help is appreciated

 

thanks

 

 

Mike

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

have a look at this contri  it should help you:

 

http://www.oscommerce.com/community/contributions,2476

 

 

thanks

 

i looked at that but it adds the time/date,

 

can i simply delete some of the variables,

 

also that method still displays order number as 1,2,3 rather than 0001,0002,0003

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

thanks

 

i looked at that but it adds the time/date,

 

can i simply delete some of the variables,

 

also that method still displays order number as 1,2,3 rather than  0001,0002,0003

 

right well i almost have it working just require a little help adjusting the following code

 

// Output Transaction_ID = YYMMDD-SSmmHH-0001
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
// $order_id is passed from the customer order
 function tep_trans_id($raw_date,$order_id) {
   if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

   $year = (int)substr($raw_date, 2, 2);
   $month = (int)substr($raw_date, 5, 2);
   $day = (int)substr($raw_date, 8, 2);
   $hour = (int)substr($raw_date, 11, 2);
   $minute = (int)substr($raw_date, 14, 2);
   $second = (int)substr($raw_date, 17, 2);
   $cart_id=sprintf("%02d%02d%02d-%02d%02d%02d-%04d",$year,$month,$day,$second,$minute,$hour,$order_id);

   return $cart_id;
 }

////

 

that is the important bit so can someone please show me how to add a variable called prefix and then modify the following parts...

$cart_id=sprintf("%02d%02d%02d-%02d%02d%02d-%04d",$year,$month,$day,$second,$minute,$hour,$order_id);

 

 

thanks

 

mike

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...