[フレーム]
Last Updated: February 25, 2016
·
1.043K
· colinodell

Disable default event observers in Magento

Simply set the "type" to "disabled". For example, if there's a default observer set like this:

<?xml version="1.0"?>
<config>
 <modules>
 <Mage_Reports>
 <version>0.7.10</version>
 </Mage_Reports>
 </modules>
 <frontend>
 <events>
 <wishlist_add_product>
 <observers>
 <reports>
 <class>reports/event_observer</class>
 <method>wishlistAddProduct</method>
 </reports>
 </observers>
 </wishlist_add_product>
 </events>
 </frontend>

</config>

Then you'd use something like this in your extension's config.xml:

<?xml version="1.0"?>
<config>
 <modules>
 <MyNamespace_MyModule>
 <version>0.1.0</version>
 </MyNamespace_MyModule>
 </modules>
 <frontend> <!-- Be careful to use <frontend> like above, <global> would not work -->
 <events>
 <wishlist_add_product>
 <observers>
 <reports>
 <type>disabled</type>
 </reports>
 </observers>
 </wishlist_add_product>
 </events>
 </frontend>
</config>

Make sure the scope matches though!

Source: http://www.bubblecode.net/en/2012/01/21/disable-an-event-observer-defined-by-default-in-magento/

AltStyle によって変換されたページ (->オリジナル) /