Magento - 2 or more observer on same event

前端 未结 3 2224
Happy的楠姐
Happy的楠姐 2021-02-14 16:50

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

3条回答
  •  北海茫月
    2021-02-14 17:22

    I think you are missing something. You can call as many functions as you can using observers for an event. But for each event, the observer's method name should be different, as well as its id.

    
        
            
                
                    singleton
                    shipmentsave/observer
                    salesOrderShipmentSaveBefore
                
            
        
    
    
    
        
            
                
                    singleton
                    bshipment/observer
                    salesOrderShipmentSaveBefore
                
            
        
    
    

    You can see in the XML that the id shipmentsave and method salesOrderShipmentSaveBefore is the same.

    Just change this and you are all done.

提交回复
热议问题