0

I am Find A Solution to call event when my controller is run. I found solution but is working on every controller run

<global>
   <events>
    <controller_action_predispatch>
     <observers>
            <controller_action_before>
                <class>Mycustom_Custom_Model_Observer</class>
                <method>myFunction</method>
            </controller_action_before>
        </observers>
     </controller_action_predispatch>
   </events>
</global>

I need to run myFunction when my Module Controller is run

1

I found Solution. Good trick

<global>
  <events>
<controller_action_predispatch_mycustomcontrollerhandler>
 <observers>
        <controller_action_before>
            <class>Mycustom_Custom_Model_Observer</class>
            <method>myFunction</method>
        </controller_action_before>
    </observers>
 </controller_action_predispatch_mycustomcontrollerhandler>

For example I need to call event On Product listing Page I use

 <controller_action_predispatch_catalog_product_list>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.