Hi,
I have my own module working correctly: /app/code/Hoop/Contact, now I need to fire sales_order_shipment_save_after event, so in my etc/config.xml I've put:
<sales_order_shipment_save_after> <observers> <hoop_contact_sales_order_shipment_save_before> <type>singleton</type> <class>hoop_contact/observer</class> <method>filterpaymentmethod</method> </hoop_contact_sales_order_shipment_save_before> </observers> </sales_order_shipment_save_after>
and inside Model/Observer.php I have:
<?php class Hoop_Contact_Model_Observer { public function filterpaymentmethod(Varien_Event_Observer $observer) { die('test'); } }
but it's not fired. I have the feeling the config.xml is somehow wrong, but cannot see the error.
Any hint?
Thanks
That looks about correct. Is sales_order_shipment_save_after within a <global><events> within the config.xml?
Have you flushed configuration cache after adding this to config.xml. This change wouldn't be picked up until cache flush and XML files are then re-read.
Do you have a generic model class definition further up the file as well? i.e. something like:
<global> <models> <hoop_contact> <class>Hoop_Contact_Model</class> </hoop_contact>
Just a note, you've hooked onto the "after" event but have named your observer "after". That might get confusing at some point so worth updating.
Try the below code:
<sales_order_shipment_save_after> <observers> <hoop_contact_sales_order_shipment_save_after> <type>singleton</type> <class>hoop_contact/observer</class> <method>filterpaymentmethod</method> </hoop_contact_sales_order_shipment_save_after> </observers> </sales_order_shipment_save_after>