0

I want to override Mage_Sales_Recurring_ProfileController in my custom module.

My /etc/config.xml

<config>
    <frontend>
        <routers>
            <sales>
                <args>
                    <modules>
                        <Namespace_Module before="Mage_Sales">Namespace_Module</Namespace_Module>
                    </modules>
                </args>
            </sales>
        </routers>
    </frontend>
</config>

and my controller file

Namespace/Module/controllers/Sales/Recurring/ProfileController.php


require_once("Mage/Sales/controllers/Recurring/ProfileController.php");
class Namespace_Module_Sales_Recurring_ProfileController extends Mage_Sales_Recurring_ProfileController
{
   public function indexAction()
    {
       // custom code
    }
}

But the control doesnt go in the overriden controller, but the core controller only.

Can anyone tell the reason why.

1 Answer 1

1

You can do one (and just one) of the following.

  1. Put your controller in Namespace/Module/controllers/Recurring/ProfileController.php and name the class Namespace_Module_Recurring_ProfileController. (I recommend this one).
  2. Change in config.xml this <Namespace_Module before="Mage_Sales">Namespace_Module</Namespace_Module> to this <Namespace_Module before="Mage_Sales">Namespace_Module_Sales</Namespace_Module>. You should use this only if you override multiple controllers from multiple modules in your module. This helps you group the controllers better. If you only override controllers from Mage_Sales, there is no need to do this. Go with the first approach.
0

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.