New Zenner
- Join Date:
- Apr 2008
- Posts:
- 23
- Plugin Contributions:
- 0
Order number ID set as UUID
I need help to set the order ID as an UUID ... of course I understand the Order ID is set as auto-increment and I shouldn't try to mess with it.
What I want is to insert an autogenerated UUID into the zencart_orders table
I have inserted an orders_uuid row into my DB
I have a code to generate an UUID (this is not my code)
<?php
$u=uuid(); // 0001-7f000001-478c8000-4801-47242987
echo $u;
echo "<br>";
function uuid($serverID=1)
{
$t=explode(" ",microtime());
return sprintf( '%04x-%08s-%08s-%04s-%04x%04x',
$serverID,
clientIPToHex(),
substr("00000000".dechex($t[1]),-8), // get 8HEX of unixtime
substr("0000".dechex(round($t[0]*65536)),-4), // get 4HEX of microtime
mt_rand(0,0xffff), mt_rand(0,0xffff));
}
function uuidDecode($uuid) {
$rez=Array();
$u=explode("-",$uuid);
if(is_array($u)&&count($u)==5) {
$rez=Array(
'serverID'=>$u[0],
'ip'=>clientIPFromHex($u[1]),
'unixtime'=>hexdec($u[2]),
'micro'=>(hexdec($u[3])/65536)
);
}
return $rez;
}
function clientIPToHex($ip="") {
$hex="";
if($ip=="") $ip=getEnv("REMOTE_ADDR");
$part=explode('.', $ip);
for ($i=0; $i<=count($part)-1; $i++) {
$hex.=substr("0".dechex($part[$i]),-2);
}
return $hex;
}
function clientIPFromHex($hex) {
$ip="";
if(strlen($hex)==8) {
$ip.=hexdec(substr($hex,0,2)).".";
$ip.=hexdec(substr($hex,2,2)).".";
$ip.=hexdec(substr($hex,4,2)).".";
$ip.=hexdec(substr($hex,6,2));
}
return $ip;
}
?>I need to know what changes I need to do to checkout_process.php to insert the generated UUID into my DB
Then my customers will have a nice Order ID ...
and noone will be able to know how much I sell.
Thanx