2 of my observer are observing same sales_order_shipment_save_before
event. ModuleA
was the one i created first and then i created ModuleB
Now only ModuleB
's observer is called and not ModuleA
.
Please let me know how can i resolve this and both of observers are called.
ModuleA
<?xml version="1.0"?>
<config>
<global>
<models>
<shipmentsave>
<class>My_Shipmentsave_Model</class>
</shipmentsave>
</models>
</global>
<adminhtml>
<events>
<sales_order_shipment_save_before>
<observers>
<shipmentsave>
<type>singleton</type>
<class>shipmentsave/observer</class>
<method>salesOrderShipmentSaveBefore</method>
</shipmentsave>
</observers>
</sales_order_shipment_save_before>
</events>
</adminhtml>
</config>
Observer.php
<?php
class My_Shipmentsave_Model_Observer
{
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
{
$shipment = $observer->getEvent()->getShipment();
return;
}
}
ModuleB
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<My_Bshipment>
<version>0.1.0</version>
</My_Bshipment>
</modules>
<admin>
<routers>
<bshipment>
<use>admin</use>
<args>
<module>My_Bshipment</module>
<frontName>bshipment</frontName>
</args>
</bshipment>
</routers>
</admin>
<adminhtml>
<events>
<sales_order_shipment_save_before>
<observers>
<shipmentsave>
<type>singleton</type>
<class>bshipment/observer</class>
<method>salesOrderShipmentSaveBefore</method>
</shipmentsave>
</observers>
</sales_order_shipment_save_before>
</events>
</adminhtml>
<global>
<models>
<bshipment>
<class>My_Bshipment_Model</class>
</bshipment>
</models>
<resources>
<bshipment_setup>
<setup>
<module>My_Bshipment</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</bshipment_setup>
<bshipment_write>
<connection>
<use>core_write</use>
</connection>
</bshipment_write>
<bshipment_read>
<connection>
<use>core_read</use>
</connection>
</bshipment_read>
</resources>
<blocks>
<!-- adminhtml>
<rewrite>
<shipment_view>My_Bshipment_Block_Adminhtml_Shipment_View</shipment_view>
</rewrite>
</adminhtml-->
<adminhtml>
<rewrite>
<sales_order_shipment_view>My_Bshipment_Block_Adminhtml_Shipment_View</sales_order_shipment_view>
</rewrite>
<rewrite>
<sales_shipment_grid>My_Bshipment_Block_Adminhtml_Shipment_Grid</sales_shipment_grid>
</rewrite>
</adminhtml>
<!-- udropship>
<rewrite>
<adminhtml_shipment_view>My_Bshipment_Block_Adminhtml_Shipment_View</adminhtml_shipment_view>
</rewrite>
</udropship-->
</blocks>
<helpers>
<bshipment>
<class>My_Bshipment_Helper</class>
</bshipment>
</helpers>
</global>
</config>
Observer.php
<?php
class My_Bshipment_Model_Observer
{
public function salesOrderShipmentSaveBefore(Varien_Event_Observer $observer)
{
$shipment = $observer->getEvent()->getShipment();
return;
}
}
Regards, Saurabh
No time to test this, but at first glance I'd try making
<shipmentsave>
distinct for each module. Something like
<observers>
<shipmentsave>
<type>singleton</type>
<class>bshipment/observer</class>
<method>salesOrderShipmentSaveBefore</method>
</shipmentsave>
</observers>
and
<observers>
<bshipmentsave>
<type>singleton</type>
<class>bshipment/observer</class>
<method>salesOrderShipmentSaveBefore</method>
</bshipmentsave>
</observers>