View Single Post
Old 10-13-2006, 10:02 PM
alphastara alphastara is offline

Advanced Member
Join Date: Jul 2005
Posts: 39

Default Order ID Random Incrementation...

Here's a good solution which a few people may be interested in. If you don't like the way X-Cart increments your order ID's by 1, eg. If you want customers to think your shop is processing more orders than just a couple since their last order...Here is a solution I threw together just increments the next order ID to be randomly between 8 and 30 orders higher than current order ID, simply change the '8' and the '30' to change the random range in increment.php...:

Create a new file called 'increment.php' in /yourxcartdirhere/include/ containing:
<?php # # This randomly increments the orderid each time an order is made... # Simply call it once an order has been made; include $xcart_dir."/include/increment.php"; # Uses this idea - db_query("ALTER TABLE xcart_orders AUTO_INCREMENT = xxxxxx"); # $advanceBy = rand(8, 30); $NewNumber = $orderids + $advanceBy; $FD_InsertQuery = "ALTER TABLE xcart_orders AUTO_INCREMENT = $NewNumber"; db_query($FD_InsertQuery); ?>

In /yourxcartdirhere/cart.php at line 803 find this:
elseif ($mode=="order_message") { $smarty->assign("main","order_message"); $location[] = array(func_get_langvar_by_name("lbl_order_processed"), "");

replace it with this:
elseif ($mode=="order_message") { $smarty->assign("main","order_message"); include $xcart_dir."/include/increment.php"; $location[] = array(func_get_langvar_by_name("lbl_order_processed"), "");

NOTE: This has been tested on 4.0.19 ONLY, not sure if it's the same for other versions, can't see why not.
Alphastara | New Age Products
V: 4.1.6 + AOM
Reply With Quote