Forums / Suggestions / Random-Increment Order Id's

Random-Increment Order Id's

Author Message

cubby cub

Tuesday 25 August 2009 10:57:11 am

Not sure if this is already available but...

Nothing worse than going to a store and realizing you're the 1st person to place an order. It'd be great if the invoice numbers random-incremented progressively. it's also be great if you could select the starting order #. "1" sucks!

So ideally, what would happen is you can set your starting order number. Say it's 02149.

Person A places an order = Invoice #02149

Person B places an order = Invoice #02153

Person C places an order = Invoice #02167

if there are any developers, another cart i use has the following code. maybe it can give someone an idea

in a file called increment.php which relies on the concept of db_query("ALTER TABLE cart_orders AUTO_INCREMENT = xxxxxx"); , we have...

$advanceBy = rand(8, 30);
$NewNumber = $orderids + $advanceBy;
$FD_InsertQuery = "ALTER TABLE cart_orders AUTO_INCREMENT = $NewNumber";
db_query($FD_InsertQuery);

then in the php file for the cart/cart.php, the following code...

elseif ($mode=="order_message") {
	$smarty->assign("main","order_message");
	include $cart_dir."/include/increment.php";
	$location[] = array(func_get_langvar_by_name("lbl_order_processed"), "");

and that's it. anyone capable of doing this?

thanks

Aang: Just like the legend says, we let love lead the way.