-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New event "order_status_changed_before_save" #1128
New event "order_status_changed_before_save" #1128
Conversation
I actually need this event in some of my projects. However, I fire it from protected function _beforeSave()
{
// ...
// Just before exiting the function.
if ($this->getStatus() != $this->getOrigData('status')) {
Mage::dispatchEvent('order_status_changed_before_save', ['order' => $this]);
}
return $this;
} It doesn't check for state changes as condition of firing, which is less granular; a state may not have changed while status changes. However, you can easily check state changes in the observer. I like firing in |
Updated this PR to reflect @kiatng example. This is indeed better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the new event into EVENTS.md.
Personally I would have used !=
, but never mind.
I think this one could be merged as it is (since it's not modifiable by other admins) and then I'll modify EVENTS.md in another PR. |
oops, it's not mergeable because of conflicts and only @woutersamaey can fix them |
completed via #2927 |
Description (*)
New event "sales_order_state_change" allows custom modules to detect an order state/status change and trigger appropriate actions. I've seen modules rewrite the order model because this was missing.
Very handy improvement.
Contribution checklist (*)