change the "DATE field" of Orders when change status

Hello all,



I want to change the “DATE field” of Orders when change status.



Let me explain :



Order 123 was placed on 01-01-2012

when I change the status from OPEN to COMPLETE I want the time date to be changed to the curent date (that date when you make change of status from OPEN to COMPLETE).



Result:



INVOiCE XXXX from Order 123 Date (today date ex: 10-01-2012)



Would anyone know what I need to solve this things?



Many thanks,

You could do this in a 'change_order_status' hook.

However, I would strongly recommend against it.

An order is essentially a contract between you and the buyer. When you start doing things like change the order date, you put yourself in an indefensible position if you ever needed to document the order to someone (court, the buyer, lawyer, etc.).



You would be better served adding a new field such as ts_complete to the orders table and then updating it with the timestamp if you really want to document when the order was changed to Complete.