Zen Cart Logo
Forums / Managing Customers and Orders / generate order ID randomly

generate order ID randomly

Locked

Views: 2,860

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
18 Apr 2009, 2:19 AM
#1
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

generate order ID randomly

hi, everyone,

Does anybody know how to made zen-cart to generate order ID in specific format?
ex. YYMMDDHHmmSS**
YY: year
MM: month
DD: day
HH: hour
mm: minute
SS: second
**: random number

if in this format, it exceedes 10 digits, which doest not allowd by the Function INT in zen-cart.

anybody know how to fix this problem? many appreciated!!:lamo:

18 Apr 2009, 2:24 AM
#2
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,767
Plugin Contributions:
9

Re: generate order ID randomly

The order number is a table ID and cannot be randomly generated. The YYMMDDHHmmSS is already created with each order and displayed on the Orders Page in the admin panel.

If you wanted any page to list the Order ID in the YYMMDDHHmmSS## format, you would just need to edit the display to reflect your format.

18 Apr 2009, 2:33 AM
#3
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Re: generate order ID randomly

hi,dbltoe,

really appreciate for your quick answers.

if i want any page to display the YYMMDDHHmmSS## format, where should i edit, or how to enable it?:D

18 Apr 2009, 2:35 AM
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: generate order ID randomly

Jerry5763837:

hi,dbltoe,

really appreciate for your quick answers.

if i want any page to display the YYMMDDHHmmSS## format, where should i edit, or how to enable it?:D
It will involve too much work if you want to have the order id recorded and displayed that way. Ask yourself if it is worth it, it will require significant amount of work to edit all the files related and to make sure things work properly, it will also require significant amount of work when installing other modules that may relate to this part, as well as additional work when upgrading.

18 Apr 2009, 2:46 AM
#5
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Re: generate order ID randomly

hi, Yellow,

many thanks for your patient explanation.

so, it is useless to do like this.

on other hand, don't you think is it so foolish to gegerate order ID one after another, which would disclose the sales status in site.

any further suggestions to un-disclose sales status on out site?
how to edit the order id? thanks

18 Apr 2009, 2:48 AM
#6
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: generate order ID randomly

Jerry5763837:

hi, Yellow,

many thanks for your patient explanation.

so, it is useless to do like this.

on other hand, don't you think is it so foolish to gegerate order ID one after another, which would disclose the sales status in site.

any further suggestions to un-disclose sales status on out site?
how to edit the order id? thanks
There are 2 approaches:

  1. you can easily set the current order to very high number if you want to
  2. or, you can have an additional field in the order table, in this field you can assign unique string (id) to it, and use it for display purpose etc.
    The nice thing about this approach, is that it doesnt touch the core code, and will not prevent the site from functioning properly
18 Apr 2009, 3:00 AM
#7
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Re: generate order ID randomly

option 1: maybe we have to discard this method.
even though set the beginning new order id to 999999 through admin---tool--store manager, the next order is 1000000 all the same, and the next is 1000001, ......., all order IDs are in sequence, through which customer can learn how many orders you have.

option 2: coud you please advise how to achieve this?
thanks for your explanation in advance.:laugh: