On the front-end, a user can save his account information (name, address, etc.). Let's call this action user-save.

I'm finding that when the user doesn't have any address information, user-save triggers the customer_save_after event. The observer then provides a Mage_Customer_Model_Customer object, which lacks address information, understandably.

If he has at least one address saved, user-save triggers customer_address_save_after. Then the observer provides a Mage_Customer_Model_Address object, which has all of the user info.

Am I getting this right? Why is this?

UPDATE: Actually it looks like when a customer has addresses in his account, customer_address_save_after is triggered in addition to customer_save_after, once for each address.


The *_save_after event is triggered for each model that extends Mage_Core_Model_Abstract when calling the save method.
When saving a customer the addresses associated to it are saved also, that's why the customer_address_save_after is dispatched.
This is don from Mage_Customer_Model_Resource_Customer::_saveAddresses() that is called from Mage_Customer_Model_Resource_Customer::_afterSave()

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.