Page: | 1 |
Topic:

New Year, new OrderNumber

boboo
See profile of: boboo
2011-12-31 14:32:58
Votes: 0
Vote answer in plus Vote answer in minus
The orderNumbers are increasing (+1) with every added order. When the New Year comes, nothing changes and the new order has the number (e.g.) 366.
If you want keep some regularity in your cart, just allow the system to give the orderNumbers with 'encoded' year (e.g.: 20110365).
The first order in year 2012 will get the number: 20120001.
The next orders will be increased (+1 = 20120002,... and so on).
The solution:
/core/orders.php function addOrder
under the line:
$aForm['iOrder']=$oFF->throwLastId(DB_ORDERS,'iOrder')+1;
add:
$iNewYear=date('Y');
$iOldYear=substr($aForm['iOrder'],0,4);
if($iNewYear!=$iOldYear)
$aForm['iOrder']=(int)$iNewYear.'0001';

So, at every first order in new year, the first 4 digits will adjust to the year and the four last digits will start with: 0001.

  » Quick.Cart v4.x

-------------------------------------------------------
http://qc-plugins.kimla.de
treewood
OpenSolution
See profile of: treewood
2011-12-31 19:00:41
Votes: 0
Vote answer in plus Vote answer in minus
what if someone have more then 9999 orders per year? :)
boboo
See profile of: boboo
2011-12-31 20:43:49
Votes: 0
Vote answer in plus Vote answer in minus
I hope,
that one who installs this feature knows his shop and rollover, and understands the difference between 0001 and 00001
;-)

Happy New Year and a lot of orders (more than 9999 :-)

-------------------------------------------------------
http://qc-plugins.kimla.de
reklam
See profile of: reklam
2012-02-03 00:02:02
Votes: 0
Vote answer in plus Vote answer in minus
How could I give to number now if they've already bought some products?
For example: 20120023 (I have 23 purchases).

Any solution?
boboo
See profile of: boboo
2012-02-03 07:45:27
Votes: 1
Vote answer in plus Vote answer in minus
Some handwork you will need.
The easiest way:
open four files from /db/
orders.php, orders_comments.php, orders_products.php & orders_status.php
Except orders_products.php all other files have the order ID in the first column (the first value in every line). In orders_products it is the second line.
Now change the values as you wish. But be carefull - in orders_status & order_products the order ID can be multiple. You have to change them all.
After you're ready, the next order will come with the ID = 20120023 + 1

-------------------------------------------------------
qc-plugins.kimla.de
boboo
See profile of: boboo
2012-02-03 07:46:29
Votes: 0
Vote answer in plus Vote answer in minus
Mistake in post above:
is: In orders_products it is the second line.
should be: In orders_products it is the second column.

-------------------------------------------------------
qc-plugins.kimla.de
reklam
See profile of: reklam
2012-02-04 02:45:19
Votes: 0
Vote answer in plus Vote answer in minus
Thank u!

What happen if I make only the last order?
boboo
See profile of: boboo
2012-02-04 13:40:14
Votes: 0
Vote answer in plus Vote answer in minus
Nothing bad.
Only the order's IDs in the list will look like:
...
20
21
22
23
20120024
20120025

-------------------------------------------------------
qc-plugins.kimla.de
Page: | 1 |
 


If You want to do this operation, please log in first ».
If You don't have an account please register ».
Valid XHTML 1.0! Valid CSS! version: 2.2.0-alfa | powered by Quick.Forum