Created
December 27, 2013 04:42
-
-
Save birchestx/8142672 to your computer and use it in GitHub Desktop.
From http://magento.stackexchange.com/questions/153/where-can-i-find-a-complete-list-of-magento-events List of Magento Events and how to find
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nicksays.co.uk/magento-events-cheat-sheet-1-7 | |
There is not a list of all magento events, because most of the events are dynamically named. | |
If you ask me, knowing these key events (and the consequences) is a good starting point (beside the list from nick): | |
Every Object extended from Mage_Core_Model_Abstract dispatches a lot events around loading, saving and deleting: | |
app/code/core/Mage/Core/Model/Abstract.php:255 | |
Mage::dispatchEvent($this->_eventPrefix.'_load_before', $params); | |
// e.g. sales_order_load_before, checkout_cart_load_before | |
For example to add checks, after the object was loaded | |
app/code/core/Mage/Core/Model/Abstract.php:267 | |
Mage::dispatchEvent($this->_eventPrefix.'_load_after', $this->_getEventData()); | |
// e.g. cms_page_load_after | |
to add additional data to the object before it is saved | |
app/code/core/Mage/Core/Model/Abstract.php:391 | |
Mage::dispatchEvent($this->_eventPrefix.'_save_before', $this->_getEventData()); | |
// e.g. catalog_product_save_before | |
To save other models after the "parent" was saved | |
app/code/core/Mage/Core/Model/Abstract.php:466 | |
Mage::dispatchEvent($this->_eventPrefix.'_save_after', $this->_getEventData()); | |
// e.g. catalogrule_rule_save_after | |
clean up, before the model is deleted | |
app/code/core/Mage/Core/Model/Abstract.php:501 | |
Mage::dispatchEvent($this->_eventPrefix.'_delete_before', $this->_getEventData()); | |
// e.g. store_delete_before | |
clean up, before the model is deleted - or maybe afterwards? You are here still in the transaction! | |
app/code/core/Mage/Core/Model/Abstract.php:529 | |
Mage::dispatchEvent($this->_eventPrefix.'_delete_after', $this->_getEventData()); | |
// e.g. website_delete_after | |
If you want to be sure the entity was deleted | |
app/code/core/Mage/Core/Model/Abstract.php:541 | |
Mage::dispatchEvent($this->_eventPrefix.'_delete_commit_after', $this->_getEventData()); | |
// e.g. customer_delete_commit_after | |
The collections extended from Mage_Core_Model_Resource_Db_Collection_Abstract have a two generic events too: | |
For example: to change the SQL to load the collection: | |
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php:588 | |
Mage::dispatchEvent($this->_eventPrefix.'_load_before', array( | |
$this->_eventObject => $this | |
)); | |
// e.g. sales_order_status_history_collection_load_before | |
For example: to add additional data to the objects: | |
app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php:637 | |
Mage::dispatchEvent($this->_eventPrefix.'_load_after', array( | |
$this->_eventObject => $this | |
)); | |
// e.g. sales_order_shipment_collection_load_after |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment