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 now...it 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: Code:
<?php In /yourxcartdirhere/cart.php at line 803 find this: Code:
elseif ($mode=="order_message") { replace it with this: Code:
elseif ($mode=="order_message") { 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. |
Re: Order ID Random Incrementation...
Thanks for this nice mod, which also works great in version 4.0.12 !
In my cart.php I found the code that must be replaced at line 709 and it had one extra line, which I didn't replace with the new code. Code:
elseif ($mode=="order_message") { Thanks again! |
Re: Order ID Random Incrementation...
In 4.1.x, you need to change:
Code:
$smarty->assign("orderids", $orderids); To: Code:
$smarty->assign("orderids", $orderids); Just tested and works like a charm! Many large scale sellers (like Amazon) have completely random order numbers. A lot of backend order management apps. collect web order #'s and also have order id's. Thus, random customer side order numbers don't really affect any legal or business issue. It does certainly make it easier that the orders are at least greater in number though... in XC's backend. - Mike |
Re: Order ID Random Incrementation...
works awesome in 4.1.x
just what I was looking for |
Re: Order ID Random Incrementation...
I've had my mod return two orders in 1 number increments (eg. 272, 273), not sure what could have caused it to not perform its operation correctly? It has worked normally since, just thought i would mention it, just one of those things i guess.
|
Re: Order ID Random Incrementation...
I noticed that in situations where the payment was pending or failed. The fixed order uses a subsequent number. But, in unique orders the numbers grow as you set them.
- Mike |
Re: Order ID Random Incrementation...
works great thanks!
|
Re: Order ID Random Incrementation...
This mod works great for me in 4.1.3
I had to do a test order to move the counter up one increment, then it started the randomizing on subsequent orders (I guess it had to teach the database where it was...) Very useful mod. |
Re: Order ID Random Incrementation...
Just what I was looking for! It works great!
Thanks, David |
Re: Order ID Random Incrementation...
I read every post in this thread and was wondering how and where to just increase the order ID from my currently xx to xxxx ?
I really don't have the need for autoincrementing between orders, just a simple way of increasing my current number to something higher. The reason for this is that I need a seperate range of order ID's as I'm currently sharing a payment gateway and we need to split our orders into seperate ranges to be able to differentiate between our shops :) Also I've just tested the script above and I have used the variables 8000 and 8010 but for some reason the change didn't show up on the next order but the second. The second order was incrementet to 8027 ??? Thanks in advance! |
Re: Order ID Random Incrementation...
Quote:
It is the very first thread in the FAQ forum. |
Re: Order ID Random Incrementation...
Works great!!! Thanks
|
Re: Order ID Random Incrementation...
Good Afternoon Everyone,
I was going through this thread and this is exactly something I would like to do as well. But instead of advancing the order number by a set value, I was hoping to have the system create a random number between 1000000 and 9999999. So I was thinking of something like this mt_srand ((double)microtime() * 1000000); $reference_number = "1"; $reference_number .= mt_rand (1000000,9999999); Would this work with X-cart? I am trying to figure out, based on all of the topic replies where I should fit this in. Please help. Thank you. |
Re: Order ID Random Incrementation...
But what will make it a unique number? This will require the database to know the numbers already used, then a call to the db to see if it's avail, then a write to the db to log a used number. Can you do this? I don't know how. But it's a good idea if it can be easily done.
|
Re: Order ID Random Incrementation...
Works in 4.1.5 after changing the code that mffowler refered to! Excellent quick mod that should be used by all stores. Thanks!
|
Re: Order ID Random Incrementation...
works like a charm, thanks!
|
Re: Order ID Random Incrementation...
Why would someone want a mod like this? Just to appear to the customer that you are doing high volume? Do you feel this would be benificial if your customers thought you did more volume than you really did? Do you think you would loose repeat business just because your web order number is low? I mean everyone has to start somewhere right?
From a quickbooks standpoint does x-cart download into your quickbooks in a sequential number by "1" with this mod or with your "random gaped number"? Without getting involved or knowing alot about this mod, I can just hear my accountant now, "Wheres the missing numbers?" This wouldn't raise a red flag for audits? |
Re: Order ID Random Incrementation...
Customers want to do business with a reputable company. If they appear to be the only person buying from you, they may start wondering why they are your only customer. You can't assume a customer will be understanding and give you the benefit of the doubt just because you are a new business starting up.
In addition, with sequential order numbers your competitor can easily find out how much volume you are doing if they wanted to. You may want to use the random mod during the startup of your store. After you get a steady inflow of sales, you can change it back. Your accountant should understand as long as you can account for everything. |
Re: Order ID Random Incrementation...
Quote:
LOL that is exactly what I did. I figured out that my competitor does on average 280 orders per day based on "secret shopping" from them in 2 week increments over a 2 month period. Now that I seen this thread I have my doubts that their volume is that much. However it actually could be according to thier "About our company" stating the size of their facility and equipment that they have. Is there a way to see what your actual order number would be had you not of used the random order number? If I launch my site using the random number generator and after 6 months I have an order number of 1283. Is there a way to see that that is actually order number 398? I'm more than likely going to install this mod before launch. |
Re: Order ID Random Incrementation...
Amazon.com uses random order IDs.
The order # for the cart doesn't have to be anything more than a reference number. Your accounting software software can (should?) be sequential, but it really doesn't matter, if you can generate a report... You can set the randomizer to small numbers or large numbers... doesn't really matter, if the purpose is simply "reference numbers" -- but check with your state or country trade office if you want to be certain. In the US, sequential reference numbers for orders is not law. It may be law in some countries. |
Re: Order ID Random Incrementation...
Quote:
Someone mentioned Amazon order numbers and I thought I would have a go at recreating their randomness and pattern of 3-7-7 digits. Code:
<?php As for testing a used number, well this code snippet uses 14 unique numbers. The possibility for creating a duplicate number with this spread is like 22,876,792,454,961:1 and I don't think it would warrant any test to see if the number was previously generated. You have better odds winning multiple powerball lottos... - Mike |
Re: Order ID Random Incrementation...
works fine for me.
nice on many thanks. |
Re: Order ID Random Incrementation...
Does anyone know if this works in v4.2.0?
I'm trying it, but it's not working for me. |
Re: Order ID Random Incrementation...
If anyone is still interested in this thread...
This mod does work on v4.2.0 For some reason, it took a few orders for it to start working. I'm not sure why. Perhaps a cache thing. |
Re: Order ID Random Incrementation...
Quote:
FYI: I noted the same issue when I recently upgrade to v4.1.12 (the first 5 or so orders incremented by exacly 1, then it started working). Seems like a caching issue could make testing a little frustrating at first. |
Re: Order ID Random Incrementation...
I've just installed this mod in 4.2.1 and it started working on the next order.
Steve. |
Re: Order ID Random Incrementation...
Good to see my mod is still going strong in 4.2 :)
|
Re: Order ID Random Incrementation...
I just wanted to report that this mod works in 4.3.0 too.
cart.php is a bit different, but the line of code that needs to be added can be inserted at line 950. |
Re: Order ID Random Incrementation... 4.3.1
In 4.3.1 it seems to be the same as the instructions for 4.1.x:
Find: $smarty->assign("orderids", $orderids); $smarty->assign("main","order_message"); $location[] = array(func_get_langvar_by_name("lbl_order_processe d"), ""); Replace with: $smarty->assign("orderids", $orderids); $smarty->assign("main","order_message"); include $xcart_dir."/include/increment.php"; $location[] = array(func_get_langvar_by_name("lbl_order_processe d"), ""); That is working for us. |
Re: Order ID Random Incrementation...
Any chance this could be upgraded for v4.4.1?
I had trouble finding the code. Thanks. |
Re: Order ID Random Incrementation...
SeaCoast, I had a problem as well looking for the code in cart.php. I ended up following post #11 from carpeperdiem. It may not jump in increments, but you can at least start with a 3, 4 or 5 digit order number.
|
Re: Order ID Random Incrementation...
I would love to have something that work for 4.4.3
|
Re: Order ID Random Incrementation...
I got to work with 4.4.3 In 4.4.x the code that handles the "order_message" mode processing is located in the "<xcart_dir>/include/checkout_init.php".
On line 511 change: $location[] = array(func_get_langvar_by_name('lbl_order_processe d'), ''); for: include $xcart_dir."/include/increment.php"; $location[] = array(func_get_langvar_by_name("lbl_order_processe d"), ''); And 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); ?> |
Re: Order ID Random Incrementation...
Quote:
$location[] = include $xcart_dir . '/include/increment.php'; array(func_get_langvar_by_name('lbl_order_processe d'), ''); ^works instead of... include $xcart_dir."/include/increment.php"; $location[] = array(func_get_langvar_by_name("lbl_order_processe d"), ''); |
Re: Order ID Random Incrementation...
Anyone know if this works in 4.5?
Thanks |
Re: Order ID Random Incrementation...
Quote:
Works perfectly in 4.5.4 as contributed by neaisha in post #34 PHP Code:
|
Re: Order ID Random Incrementation...
Tried this in v4.5.5 and it's not working. No errors, but it's still not working. I cleared the cache and tried 6 test orders. No change. :(
|
Re: Order ID Random Incrementation...
If anyone is interested...
The above code DOES work! Apparently, I needed to complete an order for it to start taking effect. Just thought I'd give an update. ;) |
Re: Order ID Random Incrementation...
I am trying to implement this in 4.6.0.
I noticed there are 2 instances of: Code:
$location[] = array(func_get_langvar_by_name('lbl_order_processed'), ''); in checkout_init.php, second appears to refer to "invoice page (order confirmation page) for amazon order details widget"... should I change it too? |
Re: Order ID Random Incrementation...
Works in 4.7.6 :-)
|
All times are GMT -8. The time now is 06:55 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.