Our site www.viart.com site is operated by latest Viart Shop 5 with default Clear design
Topic Information
everrid (Guest)
everrid (Guest)
Hi,
For my new shop i need that viart start generate order id numbers that looks like e.g. 66510000, 66510001, 66510002 instead of starting from 0. It is important for our taxing departement of our physical store. Is there any easy way to accomplish this? As far as i know Viart Cart i'll bet there is.
 
Thanks in advance.
Last modified: 4 Jan 2007 12:53 PM
 
Eugene (Guest)
Eugene (Guest)
Hi,
 
Unfortunately ViArt Shop has no setting for starting number of orders.
But there is a way to change it how you mentioned.
 
You can place a test order using frontend of the shop. This order will acquire Order No. 1. Then change this order number to 66510000 using any mysql client, just run a query:
 
UPDATE va_orders SET order_id=66510000 WHERE order_id=1
 
After such modification the next order will acquire Order No. 66510001 and so on.
 
For my new shop i need that viart start generate order id numbers that looks like e.g. 66510000, 66510001, 66510002 instead of starting from 0. It is important for our taxing departement of our physical store. Is there any easy way to accomplish this? As far as i know Viart Cart i'll bet there is.
 
Thanks in advance.
 
WBR,
ViArt Support Team
 
chey
chey
where do you find the file to change this? thanks
 
SajMalik
SajMalik
You must have access to your database - using MySQL?
I wanted to do this as I have another shop and wanted to have a different number set.
I did what Eugene recommends except that, not being so good at SQL, I simply opened the order in MySQL and changed the order number to 10000.
The following orders were then sequential - 10001 10002 etc.
 
chey
chey
yes i do have access to my database. but i have not much experience changing the files on that page. can you help?
 
chey
chey
oooooooo, i have figured this out. thanks! different control panels look differently :$
 
tv1122
tv1122
This sound a good idea, but it does NOT solve the problem, at least for 3.31. It picks +1 number from last order. I will need to study your script and find a REAL solution.
 
EP
 
-----
 
Hi,
 
Unfortunately ViArt Shop has no setting for starting number of orders.
But there is a way to change it how you mentioned.
 
You can place a test order using frontend of the shop. This order will acquire Order No. 1. Then change this order number to 66510000 using any mysql client, just run a query:
 
UPDATE va_orders SET order_id=66510000 WHERE order_id=1
 
After such modification the next order will acquire Order No. 66510001 and so on.
 
tv1122
tv1122
Here is Via get the order_id
 
function get_order_id()
{
$order_id = get_session("session_order_id");
if (!strlen($order_id)) { $order_id = get_param("cart_order_id"); }
if (!strlen($order_id)) { $order_id = get_param("oid"); }
if (!strlen($order_id)) { $order_id = get_param("cartId"); }
if (!strlen($order_id)) { $order_id = get_param("x_invoice_num"); }
return $order_id;
}
 
Can some programing people tell me where are the tables used for these parameters? Like oid, and x_invoice_num?
 
tv1122
tv1122
The solution provided by "Eugene" was WRONG!!!!
 
The right solution is
 
ALTER TABLE va_orders AUTO_INCREMENT=xxxxxxxx;
 
the xxxxxxxx is any order (invoice) # you like to start with.
 
EP
 
SajMalik
SajMalik
Please forgive the amusement of a non-programmer who just seeks a quick and easy solution.
 
It always appears to simple minds like me that programmers are just concerned with the complex solution. And then they have to challenge or correct code already submitted (I know I must be wrong)
- and this makes us marketing people just more confused I don't know
 
I just changed the table and I suspect that chey did the same. I suggest that anyone with access to mySQL just go and make the change and done with it! . . . or am I wrong again?
 
danorysy
danorysy
The solution provided by Eugene was RIGHT!!!
It works exactly as i want it to. If there is another way to solve the custom order id issue, doesn't mean that the first and for a non-programmer a very easy solution was wrong.
 
chey
chey
i agree with you christopherO. originally, i wanted to make the number be a random 5 digit, ie, it can be 12456 now and 87336 for the next order or something. but making it in a direction such that it starts with a 5 digit number is misleading itself. so i stuck with that. my knowledge on MySQL is really limited. thankfully i didn't crash my database.
 
tv1122
tv1122
everrid (Guest) stated "The solution provided by Eugene was RIGHT!!!"
 
Why do you try to place a few orders to prove your "rightness'?
 
I am not a programmer, but I can read, order_id in va_orders defined as "auto_increment". The SIMPLE, maybe the ONLY way is to change the base number (instead of starting from 0). I initially thought the program query that table, then increase 1, but it's NOT.
 
EP
 
KevinG
KevinG
EP (Guest) is correct and has provided a correct SQL statement to set the next auto-increment value.
 
From the MySQL online documentation at mysql.com:
To change the value of the AUTO_INCREMENT counter to be used for new rows, do this:
 
ALTER TABLE t2 AUTO_INCREMENT = value;
 
You cannot reset the counter to a value less than or equal to any that have already been used. For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, you can use ALTER TABLE ... AUTO_INCREMENT = value as of MySQL 4.1.12, but if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.
 
ansuk
ansuk
Fantastic! Was just looking for a way to change the order numbers as my current store is 3 years old and i didnt want the Viart replacement to show the amount of order placed to the customers. This worked a treat, thank you Yahoo!