We have Magepsycho's Store Restriction Pro installed on a development site. This should:
But while the first is working, the second isn't.
Enabling logging, and examining the logs, seems to show that it's not even trying to send the second email. It doesn't even seem to be executing the method that's supposed to send the email. And that's actually the same method ("customerSaveAfter") that's used to send the first email.
I noticed that config.xml included the following:
<events>
<customer_save_after> <observers> <magepsycho_storerestrictionpro_customer_save_after> <type>model</type> <class>magepsycho_storerestrictionpro/observer</class> <method>customerSaveAfter</method> </magepsycho_storerestrictionpro_customer_save_after> </observers>
</customer_save_after>
However, I've read that customer_save_after only applies when the customer saves changes to their own account, not when an administrator saves changes to their account. So that might explain why the second emails are not being sent. Therefore, I tried adding the following immediately afterwards:
<adminhtml_customer_save_after> <observers> <magepsycho_storerestrictionpro_adminhtml_customer_save_after> <type>model</type> <class>magepsycho_storerestrictionpro/observer</class> <method>customerSaveAfter</method> </magepsycho_storerestrictionpro_adminhtml_customer_save_after> </observers> </adminhtml_customer_save_after>
However, this seemed to have no effect.
Is there something wrong with my code? Or is this just the wrong approach?
Thanks.
Hi @robbm,
Are you sure your event isn't triggered?
Can you perform a silly tetst by adding something like:
Mage::log('testing my observer');
Add that at the first line of your observer method? (and enable the Magento's logs)
I understand the event should work.
Also, are you using the emails queue? (with the cron configuration)
Thanks for the suggestion.
The method does some logging as soon as it's called. This works when other events are triggered, but not when I expect this event to be triggered.
However, just to double-check, I briefly added some logging to the start of the dispatchEvent function in Mage.php, and that shows lots of other events being triggered. But not this one.
Hi @robbm,
I was checking some old modules (from me) and I got something similar (I was triggering an action after the customer is saved at the frontend or backend).
So I've used a global event:
<customer_save_after> <observers> <mymodule_customer_save_global> <class>mymodule/observer_customer</class> <method>saveCustomer</method> </mymodule_customer_save_global> </observers> </customer_save_after>
And then my method gets always the same data.
Can you check if your second observer is being triggered at the global, frontend or adminthml events?