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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 04:26:39
Script start
Timing: Jan 18 2025 04:26:39
Module start 'layout'
Timing: Jan 18 2025 04:26:39
Module start 'content'
Timing: Jan 18 2025 04:26:39
Module end 'content'
Timing: Jan 18 2025 04:26:39
Script end

Main resources:

Total runtime0.4151 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 587.9141152.6250
Module start 'layout' 0.00760.0025 740.539139.4453
Module start 'content' 0.01020.4036 779.9844468.5469
Module end 'content' 0.41370.0013 1,248.53138.3203
Script end 0.4150  1,256.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00431.0461160.0003
Check MTime0.00150.3579160.0001
Mysql Total
Database connection0.00110.273210.0011
Mysqli_queries0.370689.2740460.0081
Looping result0.00050.1117440.0000
Template Total0.383492.420.1917
Template load0.00290.687820.0014
Template processing0.380691.686420.1903
Template load and register function0.00010.019010.0001
states
state_id_array0.00100.241110.0010
state_identifier_array0.00070.166220.0003
Override
Cache load0.00240.5821170.0001
Sytem overhead
Fetch class attribute can translate value0.00070.161610.0007
Fetch class attribute name0.00080.202820.0004
XML
Image XML parsing0.00040.107210.0004
class_abstraction
Instantiating content class attribute0.00000.000720.0000
General
dbfile0.00080.1966160.0001
String conversion0.00000.001740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs