php - Overide Magento Enterprise Core Observer Method -
im trying on ride several methods located in enterprise_catalog_model_observer class. in core config observer defined
<catalog_product_save_after> <observers> <catalog_product_save_custom_redirect> <class>enterprise_catalog/observer</class> <method>saveproductcustomredirect</method> </catalog_product_save_custom_redirect> </observers> </catalog_product_save_after>
in enxtension app/code/local/extensioname/redirects/etc/config.xml
<?xml version="1.0"?> <config> <modules> <extensioname_redirects> <version>0.1.0</version> </extensioname_redirects> </modules> <global> <models> <extensioname_redirects> <class>extensioname_redirects_model_observer</class> </extensioname_redirects> </models> </global> <frontend> <events> <catalog_product_save_after> <observers> <extensioname_redirects> <class>extensioname_redirects_model_observer</class> <method>saveproductcustomredirect</method> </extensioname_redirects> </observers> </catalog_product_save_after> </events> </frontend> </config>
in app/code/local/extensioname/redirects/model/observer.php
class extensioname_redirects_model_observer extends enterprise_catalog_model_observer { public function saveproductcustomredirect(varien_event_observer $observer) { ... } }
but core observer still firing saveproductcustomredirects , extension doing nothing. please help
for it's worth: if having troubles problem came down not rewriting core observer in extensions config. word casing played issue in extension started working once of xml tags changed lowercase within the models node. updated extensions config below.
<?xml version="1.0"?> <config> <modules> <my_extension> <version>0.1.0</version> </my_extension> </modules> <global> <models> <my_extension> <class>my_extension_model_observer</class> </my_extension> <!-- updated here rewrite core observer enterprise_catalog_model_observer --> <enterprise_catalog> <rewrite> <observer>my_extension_model_observer</observer> </rewrite> </enterprise_catalog> </models> </global> <frontend> <events> <catalog_product_save_after> <observers> <my_extension> <class>my_extension_model_observer</class> <method>saveproductcustomredirect</method> </my_extension> </observers> </catalog_product_save_after> </events> </frontend> </config>
Comments
Post a Comment