Skip to content

Commit

Permalink
New event "order_status_changed_before_save" (#2927)
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Jan 13, 2023
1 parent 9800d26 commit 263df62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/code/core/Mage/Sales/Model/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,11 @@ protected function _beforeSave()
if (!$this->getId()) {
$this->setData('protect_code', substr(md5(uniqid(mt_rand(), true) . ':' . microtime(true)), 5, 6));
}

if ($this->getStatus() !== $this->getOrigData('status')) {
Mage::dispatchEvent('order_status_changed_before_save', ['order' => $this]);
}

return $this;
}

Expand Down
1 change: 1 addition & 0 deletions docs/EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
| model_save_commit_after | 1.9.4.5 |
| on_view_report | 1.9.4.5 |
| order_cancel_after | 1.9.4.5 |
| order_status_changed_before_save | 19.5.0 / 20.1.0 |
| page_block_html_topmenu_gethtml_after | 1.9.4.5 |
| page_block_html_topmenu_gethtml_before | 1.9.4.5 |
| payment_form_block_to_html_before | 1.9.4.5 |
Expand Down

0 comments on commit 263df62

Please sign in to comment.