Best way to generate order numbers for an online store?

前端 未结 13 2051
野的像风
野的像风 2021-01-31 00:09

Every order in my online store has a user-facing order number. I\'m wondering the best way to generate them. Criteria include:

  • Short
  • Easy to say over the
13条回答
  •  余生分开走
    2021-01-31 00:33

    At my old place it was the following:

    The customer ID (which started at 1001), the sequence of the order they made then the unique ID from the Orders table. That gave us a nice long number of at least 6 digits and it was unique because of the two primary keys.

    I suppose if you put dashes or spaces in you could even get us a little insight into the customer's purchasing habits. It isn't mind boggling secure and I guess a order ID would be guessable but I am not sure if there is security risk in that or not.

提交回复
热议问题