I have a controller which is configured to handle requests prior to the core controller using a config.xml similar to this;

          <myextension before="Mage_CatalogSearch">My_Extension</myextension>

The action it overrides should occasionally pass-through to the next (CatalogSearch) controller, and other times should execute it's own action and return--without running the CatalogSearch action.

class My_Controller extends Mage_Core_Controller_Front_Action
    public function indexAction()
        if ($this->shouldRun())
            // Stop further processing

        // Continue to next controller

In my controller action how can I prevent the next controller from being called?

2 Answers 2


You want to use


if im not mistaken.

  • In this case I'm not actually inheriting from the controller, just intercepting a request to it. Although I may just switch to inheritance as it's not a big issue in my current scenario.
    – STW
    Commented Oct 23, 2014 at 18:12
  • I think that is the best approach.
    – mbalparda
    Commented Oct 23, 2014 at 18:56

I don't really understand the main goal of it, but like you described it in the second code listing, there should be just an else path because you state, that you want to stop further processing?

If I am wrong, can you please be a little bit more precise on what you want to achieve.

It would also not hurt to inherit the Mage_CatalogSearch_*Controller you want to rewrite.

  • In my code example I would like the response to return at the // Stop comment--however using a return there still seems to execute the next controller action. My question is how do I stop the next controller from running when using the before="" attribute to intercept a request/route?
    – STW
    Commented Oct 23, 2014 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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