Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1] 2 3   Go Down
Print
Author Topic: how to - change order_id  (Read 34771 times)
Steame
Newbie
*
Posts: 3


« on: December 28, 2005, 04:40:06 AM »

after some time to find here any solution i wrote it self:

question:
----
how it is possible to change the given "order_id" (not "order_number" !!)
would nice to have a unique 10-bit number, a combine with random
generated bits and time-stamp

answer in 5 steps:
----
Step 1: you have to change your "xx_vm_orders" tab self by hand e.g. with phpmyadmin
- alter "order_id" -> autoincrement to "order_id" -> blank

Step 2: insert my script in "ps_checkout.php" on place your choice
          (..\administrator\components\com_virtuemart\classes)
Code:
/**************************************************************************
** name: get_order_id()
** created by: sten
** description:  Create an order id by using 5 random number
**               and the current unix timestamp.
** parameters:
** returns: unique order_id
***************************************************************************/
function get_order_id() {

/* Generated a unique order id */
$stri="";
srand();
  for($i=0;$i<5;$i++)
  {
    $stri.=rand(0,9);
  }
$order_id = $stri + (string)time();
return($order_id);
}
Step 3: insert followed script after "$order_number = $this->get_order_number();"
Code:
/* Set the order id */
$order_id = $this->get_order_id();
Step 4: search $q = "INSERT INTO #__{vm}_orders "; and alter this complete section in:
Code:
/* Insert the main order information */
$q = "INSERT INTO #__{vm}_orders ";
$q .= "(order_id, user_id, vendor_id, order_number, user_info_id, ";
$q .= "ship_method_id, order_total, order_subtotal, order_tax, order_shipping, ";
$q .= "order_shipping_tax,  order_discount, coupon_discount,order_currency, order_status, cdate, ";
$q .= "mdate,customer_note,ip_address) ";
$q .= "VALUES (";
$q .= "'" . $order_id . "', ";
$q .= "'" . $auth["user_id"] . "', ";
$q .= $ps_vendor_id . ", ";
$q .= "'" . $order_number . "', '";
$q .= $d["ship_to_info_id"] . "', '";
Thats all, finish
you will have a 10-bit order_id liike this: 1135854683
she will given unique


« Last Edit: October 10, 2007, 01:43:28 AM by Soeren » Logged

Steame
----------------------------
vm......... 1.0.1
joomla.... 1.0.4
jackplus.. 1.0.4
Apache... 2.0 (loc)
MySql..... 4.0.24 (loc)
Firefox.... 1.0.7
.
.
.
Darwin
Newbie
*
Posts: 3


« Reply #1 on: February 14, 2006, 15:04:22 PM »

Does this really works???
Is there any other way???
Logged
deneb
Moderator
Hero Member
*
Posts: 654


« Reply #2 on: February 14, 2006, 16:13:02 PM »

Can you discuss why you want to do this? Security? Deception?
Logged
Darwin
Newbie
*
Posts: 3


« Reply #3 on: February 14, 2006, 16:50:01 PM »

Maybe both, security and deception.
Thinking the way it's said here http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=15181.0
Logged
Darwin
Newbie
*
Posts: 3


« Reply #4 on: February 15, 2006, 23:38:15 PM »

I read the post again and I realized that I did not understand the first time.

The post was really helpful.
I've changed the code and it works!!!!

Thanks Steame!!!
Logged
gregcaulder
Newbie
*
Posts: 9


« Reply #5 on: March 03, 2006, 22:49:17 PM »

how do you change the starting order number?

we are switching from a custom system to virtumart, and i need to start the order number around 3,000.

any suggestions?



Greg
Logged
Steame
Newbie
*
Posts: 3


« Reply #6 on: March 10, 2006, 06:07:05 AM »

hi Greg,

it is a random generated number, without startpoint - a sequential number isīt necessary for accounting i think,
you can change it in vm self - have a look to your admin panel ...

sten
Logged

Steame
----------------------------
vm......... 1.0.1
joomla.... 1.0.4
jackplus.. 1.0.4
Apache... 2.0 (loc)
MySql..... 4.0.24 (loc)
Firefox.... 1.0.7
.
.
.
Kantieboy
Newbie
*
Posts: 1


« Reply #7 on: March 22, 2006, 06:35:53 AM »

Where is the "xx_vm_orders" tab located to change the - alter "order_id" -> autoincrement to "order_id" -> blank? I cannot locate it?


Logged
Steame
Newbie
*
Posts: 3


« Reply #8 on: April 09, 2006, 02:21:10 AM »

Since vm version 1.0.4 you have to change the code in ps_checkout.php like
this here, Step 4 of my "to do list" above:

      $q = "INSERT INTO #__{vm}_orders \n";
      $q .= "(order_id, user_id, vendor_id, order_number, user_info_id, ship_method_id, \n";
      $q .= "order_total, order_subtotal, order_tax, order_tax_details, order_shipping, \n";
      $q .= "order_shipping_tax, order_discount, coupon_discount,order_currency, order_status, cdate, \n";
      $q .= "mdate,customer_note,ip_address) \n";
      $q .= "VALUES (";
      $q .= "'" . $order_id . "', ";
      $q .= "'" . $auth["user_id"] . "', ";
      $q .= $ps_vendor_id . ", ";
      $q .= "'" . $order_number . "', '";
      $q .= $d["ship_to_info_id"] . "', '";

itīs run well ...

« Last Edit: April 09, 2006, 02:23:45 AM by Steame » Logged

Steame
----------------------------
vm......... 1.0.1
joomla.... 1.0.4
jackplus.. 1.0.4
Apache... 2.0 (loc)
MySql..... 4.0.24 (loc)
Firefox.... 1.0.7
.
.
.
chey
Newbie
*
Posts: 41


« Reply #9 on: October 23, 2006, 02:18:17 AM »

thank you! this worked for me! Wink
Logged
Michael Tucker
Newbie
*
Posts: 20


« Reply #10 on: November 22, 2006, 11:46:07 AM »

works perfectly, thanks
Logged
Rico Suave
Full Member
***
Posts: 223


WWW
« Reply #11 on: January 07, 2007, 14:35:59 PM »

doenst work for me.... I think in the mean time ps_checkout.php has changed....

after finalizing the order, the screen turns blank. No order is recorded then...

Help is appreciated, since I am really looking for this solution....
Logged

Bill Smith
Newbie
*
Posts: 25


« Reply #12 on: February 02, 2007, 00:34:37 AM »

You're right. This method is now officialy Useless.
Logged
Tristan L.
Newbie
*
Posts: 7


« Reply #13 on: May 11, 2007, 13:35:07 PM »

What VirtueMart needs is this type of order number coding:
YYMMDD-HHMMSS-XXXX
E.g. 070511-202715-9384
       DATE-TIME-RANDOM

Where XXXX stands for any random number. This way you can receive 9999 orders per second. None of the customers is capable of finding out how many orders your webshop handles, this can create a sense of trust - which is very important online.

Is there a way of creating this possibility?
Logged
Rico Suave
Full Member
***
Posts: 223


WWW
« Reply #14 on: May 12, 2007, 11:33:51 AM »

not now... Sad
Logged

Pages: [1] 2 3   Go Up
Print
Jump to: