The best way to do this is to simply re-declare the observer definition in the config.xml file.
For example, I needed to disable the observer enterprise_persistent_cart , which was declared in the controller_action_layout_generate_blocks_after event using the Enterprise_Persistent module.
The declaration in the Enterprise_Persistent config.xml is
<frontend> <events> <controller_action_layout_generate_blocks_after> <observers> <enterprise_persistent_cart> <class>enterprise_persistent/observer</class> <method>removeCartLink</method> </enterprise_persistent_cart> </observers> </controller_action_layout_generate_blocks_after>
So, I created a module, and in my config.xml module I did the following:
<frontend> <events> <controller_action_layout_generate_blocks_after> <observers> <enterprise_persistent_cart> <type>disabled</type> </enterprise_persistent_cart> </observers> </controller_action_layout_generate_blocks_after>
I also made my module dependent on the Enterprise_Persistent module. This is necessary to ensure that my config.xml module is processed AFTER the USER Enterprise_Persistent module.xml. I did this by doing the following in my module application / etc / modules. Module declaration file My_Module.xml
<config> <modules> <Atlex_AddCartLinkToHeader> <active>true</active> <codePool>local</codePool> <depends> <Enterprise_Persistent/> </depends> </Atlex_AddCartLinkToHeader> </modules> </config>
For each event, there can only be one observer action specified for a given observer name. Therefore, while my config.xml module is being processed after the config.xml file Enterprise_Persistent, my observer declaration for enterprise_persistent_cart will be the action of the observer.
Type < disabled < / type node will disconnect the observer from shelling. If you want to override the observer to execute your own method, you simply replace the type < node to your observer < class and < .
This allows you to override / disable observers without overriding the main classes. It is more extensible for future developers.