2

I would like to trigger an event when admin add a new customer, I created a new module under local code pool. It is listed in admin->system->configuration->advanced also.

But after save event is not triggered.

Below is my code:

config.xml

 <config>
   <global>
    <adminhtml>
        <events>
            <customer_save_after>
                <observers>
                    <My_WebService_customer_register_success>
                        <type>singleton</type>
                        <class>My_WebService_Model_Observer</class>
                        <method>customerRegisterSuccess</method>
                    </My_WebService_customer_register_success>
                </observers>
            </customer_save_after>
        </events>
    </adminhtml>
   </global>
 </config>

Observer.php

<?php
class My_Module_Model_Observer {
    public function customerRegisterSuccess() {
        Mage::log('I came inside', null, 'beta_version.log');
    }
}
?>

When no log created I checked my log settings enabled or not, it is enabled also. But event not triggered,

4

You can use adminhtml_customer_save_after event for admin customer creation.

i.e.,

<config>
    <adminhtml>
        <events>
            <adminhtml_customer_save_after>
                <observers>
                    <My_WebService_customer_register_success>
                        <type>singleton</type>
                        <class>My_WebService_Model_Observer</class>
                        <method>customerRegisterSuccess</method>
                    </My_WebService_customer_register_success>
                </observers>
            </adminhtml_customer_save_after>
        </events>
    </adminhtml>
</config>

Check this code

Edit :

You have to call the event inside the adminhtml not inside global

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.