Magento Get arg_name in observer -
i can set observer listen when 1 of controller method tigger, however, want pass parameter observer, how can parameter in observer? arg_value
thanks lot
<events> <controller_action_predispatch_mycompany_mymodule_controllername_recalculation> <observers> <mycompany_mymodule> <class>mycompany_mymodule_model_observer</class> <method>processgo</method> <args> <arg_name>arg_value</arg_name> </args> </mycompany_mymodule> </observers> </controller_action_predispatch_mycompany_mymodule_controllername_recalculation> </events>
please try following
<events> <event_to_observe> <observers> <observer_name> <type>singleton</type> <class>namespace_module_model_observerclass</class> <method>observermethod</method> <args> <arg_name>arg_value</arg_name> </args> </observer_name> </observers> </event_to_observe> </events>
<?php /** * observer class */ class namespace_module_model_observerclass { /** * observer method * * @param varien_event_observer $observer * @return void */ public function observermethod(varien_event_observer $observer) { $args = mage::helper('ecmessenger')->getobserverargs($observer, get_class($this), __function__); mage::log($args, null, 'observer.log'); } }
make sure here mage::helper('ecmessenger') helper need create , specify in config.xml
let me know if have query
Comments
Post a Comment