app/code/core/Customer/etc/config.xml
registers observers for before and after Magento saves the address:
<events>
<customer_address_save_before>
<observers>
<customer_address_before_save_viv_observer>
<class>customer/observer</class>
<method>beforeAddressSave</method>
</customer_address_before_save_viv_observer>
</observers>
</customer_address_save_before>
<customer_address_save_after>
<observers>
<customer_addres_after_save_viv_observer>
<class>customer/observer</class>
<method>afterAddressSave</method>
</customer_addres_after_save_viv_observer>
</observers>
</customer_address_save_after>
</events>
…but I can't find any evidence that Magento actually dispatches these events anywhere:
$ grep -RF 'dispatchEvent(' . | grep -F customer_addres
./app/code/core/Mage/Customer/Model/Address/Abstract.php: Mage::dispatchEvent('customer_address_format', array('type' => $formatType, 'address' => $this));
As far as I understand Mage::dispatchEvent(…)
is the only way Magento fires events off. Do these events actually happen? (I'm hoping so, because I could really use some events that fire at address save time.)
Yes it dispatch but some events are hard to find where are dispatched because magento do this dynamically. This happens for almost all core models on save. Magento dispatch those events like this:
Mage::dispatchEvent($this->_eventPrefix.'_save_before', $this->_getEventData());
Mage::dispatchEvent($this->_eventPrefix.'_save_after', $this->_getEventData());
So grep will fail to find where this events are dispatched.
For example model "Mage_Customer_Model_Address" extends class "Mage_Customer_Model_Address_Abstract" which has set $_eventPrefix = 'customer_address'
and in Mage_Core_Model_Abstract in _beforeSave() and _afterSave() methods that events are dispatched.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With