Where would you start your order number iteration at?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

sparrrow
Forum Commoner
Posts: 81
Joined: Mon Oct 20, 2008 12:22 pm

Where would you start your order number iteration at?

Post by sparrrow »

Just a poll... So you create a new ecommerce site, and are ready to push it to production and start bringing in orders. What number do you start your order number auto-increment at? and why? A random number seems non-sensical and possibly difficult to track and report on, yet a flat rounded number may make it too easy for someone to determine how many web orders you've had.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Where would you start your order number iteration at?

Post by alex.barylski »

What number do you start your order number auto-increment at? and why?
Start at one as it's the default auto-increment number provided by MySQL. Random introduces potential collision, requiring a re-attempt.

I guess I would ask myself, who cares if anyone figures out how many web orders I've had. Prefix the order with some junk that is used strictly for aesthetica reasons.

Code: Select all

$pkid = 1;
$order = "AK-E57X-$pkid";
 
echo '<a href="?orderid='.$order.'">Some Item</a>';
 
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Where would you start your order number iteration at?

Post by Christopher »

sparrrow wrote:... yet a flat rounded number may make it too easy for someone to determine how many web orders you've had.
If your criterion is to have a starting number that makes it difficult for someone to "determine how many web orders you've had" (or perhaps give the impression that you have a lot of orders ;)) then pick a number that makes you happy. There is no technical reason for this, so follow your heart! ;)
(#10850)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Where would you start your order number iteration at?

Post by josh »

You could just multiply the order numbers whenever the user sees them, as long as you multiply by the same amount every time. Unless someone is repeatedly ordering they wouldn't notice a pattern. If you don't mind the programming doing the re-attempt isn't that big of a deal. I've generated things like serial keys by performing modifications to an md5 of the primary key, etc...
sparrrow
Forum Commoner
Posts: 81
Joined: Mon Oct 20, 2008 12:22 pm

Re: Where would you start your order number iteration at?

Post by sparrrow »

arborint wrote:
sparrrow wrote:... yet a flat rounded number may make it too easy for someone to determine how many web orders you've had.
If your criterion is to have a starting number that makes it difficult for someone to "determine how many web orders you've had" (or perhaps give the impression that you have a lot of orders ;)) then pick a number that makes you happy. There is no technical reason for this, so follow your heart! ;)
What would YOU do though? I'm not looking for advice; just curious to know how other people approach this. :)

PCSpectra, my reason for not wanting users to know how many orders I've had is the same reason eBay has a feedback score for users. You have less faith in a user with low feedback, and I don't want a brand new web shop that I create to give that vibe.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Where would you start your order number iteration at?

Post by josh »

You can set the auto increment value to, say 40234 and let it count by 1 from there on out, generally they won't see the id till after they pay tho
André D
Forum Commoner
Posts: 55
Joined: Thu Aug 28, 2008 7:03 pm

Re: Where would you start your order number iteration at?

Post by André D »

I often use 1000 as the start of auto-incrementing values that are visible to customers. When you launch a new system and haven't had many orders yet, telling a customer "Your order number is 1006" looks better to me than "Your order number is 6." It's purely cosmetic.
André D
Forum Commoner
Posts: 55
Joined: Thu Aug 28, 2008 7:03 pm

Re: Where would you start your order number iteration at?

Post by André D »

André D wrote:I often use 1000 as the start of auto-incrementing values that are visible to customers. When you launch a new system and haven't had many orders yet, telling a customer "Your order number is 1006" looks better to me than "Your order number is 6." It's purely cosmetic.
As a bonus, you can reserve order numbers 1–999 for internal use, testing, etc. Also, starting at 1000 makes it very easy to casually count how many orders you've taken at a glance.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Where would you start your order number iteration at?

Post by Benjamin »

Just start it at 324596502
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Where would you start your order number iteration at?

Post by Christopher »

:)
(#10850)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Where would you start your order number iteration at?

Post by josh »

André D wrote: "Your order number is 1006" looks better to me than "Your order number is 6." It's purely cosmetic.
Why not 0006 :D
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Re: Where would you start your order number iteration at?

Post by malcolmboston »

personally i use time () as my order reference number, this doesnt give out any information regarding total sales 8)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Where would you start your order number iteration at?

Post by josh »

But you turn down a customer if the shop is getting more than 1 sale at a time? ( or what happens if order id#s collide, are you sure it is a customer friendly degradation or does your system crash? )
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: Where would you start your order number iteration at?

Post by Jenk »

We continue to use the same database after release, so the number is going to be as high as whatever it was when testing finished. The data is blanked, but the increment is kept. E.g. one of our systems just started with the ID of 32918 because that is how many test records were created (6 month agile development meant a lot of test data was created)
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Where would you start your order number iteration at?

Post by josh »

That only works if your tests don't drop & re-create the tables, but thats a good point. At the end of the day I doubt the order #s are going to hurt anything. Another thing some people do is just prefix the date like instead of 000001, they'd have 20090419-000001 ( 2009 / 04 / 19 ). But you have to ask yourself what it would be like trying to read that # vs the first one?
Post Reply