New Year, new OrderNumber

boboo

Avatar: boboo

2011-12-31 14:32

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)

Avatar: treewood

2011-12-31 19:00

what if someone have more then 9999 orders per year? :)

boboo

Avatar: boboo

2011-12-31 20:43

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

Avatar: reklam

2012-02-03 00:02

How could I give to number now if they've already bought some products?
For example: 20120023 (I have 23 purchases).

Any solution?

boboo

Avatar: boboo

2012-02-03 07:45

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

Avatar: boboo

2012-02-03 07:46

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

Avatar: reklam

2012-02-04 02:45

Thank u!

What happen if I make only the last order?

boboo

Avatar: boboo

2012-02-04 13:40

Nothing bad.
Only the order's IDs in the list will look like:
...
20
21
22
23
20120024
20120025

qc-plugins.kimla.de

Back to top
about us | contact