It seems there is no order state event by default, so how do you usually go about observing order state change? There are two possibilities I see: a) Overwrite the sales/order model to create your custom event for a state change b) Observe the order save event and look at the state in there
Is one of these the way to go or is there a better option?
Edit: Thanks for your answers so far. The situation is a bit more complicated. I want to add information to the order depending on the current state. Now here is the problem: In the save_before event I still have the old state and do not now the new state, because in the sales/order model the _beforeSave() method is as follows:
parent::_beforeSave(); $this->_checkState(); //...
So the event is processed in
parent::_beforeSave(); BUT the order state is actually changed afterwards in
$this->_checkState(); (this is the automatic change, e.g. if you create an invoice, the state is moved to processing if no shipment is there, yet)
I cannot use the save_after event either, since I want to save sth. at the order and it would probably break everything to call a save in the save_after event.
Any ideas? My only idea now is to replicate the
$this->_checkState(); behavior in my save_before observer to find out what the state will finally be...