Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Order ID Random Incrementation...
 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #21  
Old 11-17-2007, 05:17 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default Re: Order ID Random Incrementation...

Quote:
Originally Posted by carpeperdiem
But what will make it a unique number?
Actually, computers can't generate a true random number as any deterministic method would necessitate that it is not 'random' by definition. But for most intensive purposes, you can create a 'psuedo random' number.

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 // Range of numbers // Minimum number $min = "1000000"; // Maximum number $max = "9999999"; echo "105-". mt_rand($min, $max); echo "-". mt_rand($min, $max); ?>
That will spit out an Amazon-esque Order ID. Note, I said 'Order ID' which is what Amazon refers to an order as. Most certainly they would have a unique internal ordering system.

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
__________________
4.1.9
Reply With Quote
  #22  
Old 10-10-2008, 10:08 AM
  stevep's Avatar 
stevep stevep is offline
 

Advanced Member
  
Join Date: Jul 2005
Location: uk
Posts: 58
 

Default Re: Order ID Random Incrementation...

works fine for me.

nice on many thanks.
__________________
X-Cart version 4.4.5
PHP 5.2.13
MySQL server 5.0.51a-community-log
MySQL client 5.0.51a
Web server Apache/2.2.8 (Unix) mod_ssl/2.2.8
Operation system Linux
Perl 5.008008

http://temptinglysexy.co.uk
Reply With Quote
  #23  
Old 02-02-2009, 12:31 PM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default 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.
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #24  
Old 02-05-2009, 02:15 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default 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.
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #25  
Old 04-21-2009, 08:38 AM
 
JRC JRC is offline
 

Advanced Member
  
Join Date: May 2007
Posts: 38
 

Default Re: Order ID Random Incrementation...

Quote:
Originally Posted by seaCOAST
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.


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.
__________________
X-Cart Pro 4.1.12 | Linux | MySQL
Reply With Quote
  #26  
Old 05-21-2009, 02:42 PM
 
steve.thompson steve.thompson is offline
 

eXpert
  
Join Date: Feb 2009
Location: Sydney, Australia
Posts: 302
 

Default Re: Order ID Random Incrementation...

I've just installed this mod in 4.2.1 and it started working on the next order.

Steve.
__________________
X-Cart Gold 4.2.1 / 4.4.2
X-AOM, X-SpecialOffers
Download Expander 2.1.3 / 2.2.0
Reply With Quote
  #27  
Old 05-26-2009, 02:30 AM
 
alphastara alphastara is offline
 

Advanced Member
  
Join Date: Jul 2005
Posts: 39
 

Default Re: Order ID Random Incrementation...

Good to see my mod is still going strong in 4.2
__________________
Alphastara | New Age Products
www.alphastara.com.au
V: 4.1.6 + AOM
Reply With Quote
  #28  
Old 12-22-2009, 02:40 PM
 
srise srise is offline
 

Member
  
Join Date: Oct 2005
Location: Bothell, WA. USA
Posts: 10
 

Default 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.
__________________
XCart Gold v4.3.2 [Linux]
Reply With Quote

The following user thanks srise for this useful post:
steve.thompson (12-22-2009)
  #29  
Old 03-24-2010, 09:33 AM
 
MBA MBA is offline
 

eXpert
  
Join Date: Apr 2006
Posts: 245
 

Default 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.
__________________
xCart Pro Version 4.0.17, 4.0.19, 4.1.8, 4.1.10, 4.1.11, 4.1.12 - retired
xCart Pro Version 4.3.1 - production
xCart Pro Version 4.5.1 - testing
RHEL Platform
Reply With Quote
  #30  
Old 12-18-2010, 10:22 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default Re: Order ID Random Incrementation...

Any chance this could be upgraded for v4.4.1?

I had trouble finding the code.

Thanks.
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:39 AM.

   

 
X-Cart forums © 2001-2018