1
votes

i want observer event for the customer delete action in magento. There is any observer is there for that or i create custom observer. I Search a lot but not find the observer for the customer delete action in admin grid area

2
are you want which observer is trigger when customer is creating or else?Amit Bera

2 Answers

6
votes

The customer model extends Mage_Core_Model_Abstract which has a _beforeDelete() and _afterDelete() methods. Each delete method fires 2 dispatch events:

_beforeDelete():

Mage::dispatchEvent('model_delete_before', array('object'=>$this));
Mage::dispatchEvent($this->_eventPrefix.'_delete_before', $this->_getEventData());

_afterDelete():

Mage::dispatchEvent('model_delete_after', array('object'=>$this));
Mage::dispatchEvent($this->_eventPrefix.'_delete_after', $this->_getEventData());

Too hook into these events, just set the config.xml of your module to fire methods when the customer model is in the process of being deleted. The customer model's $_eventPrefix value is 'customer', so the following should fire MyModule_Model_Observer:: onCustomerDeleteDoThis() right before the customer object is deleted:

<events>
    <customer_delete_before>
       <observers>
          <my_module_delete_customer>
            <class>mymodule/observer</class>
            <method>onCustomerDeleteDoThis</method>
          </my_module_delete_customer >
        </observers>
     </customer_delete_before>
</events>
1
votes

I Done Is Works for me..there is observer event is there for magento customer delete after

<customer_delete_commit_after>`

</customer_delete_commit_after>

Use the Observer to the customer delete after event