1

I want to override OrderController from

Adminhtml/controllers/Sales/OrderController

In my config.xml I have written this,

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Neo_Recurring before="Mage_Adminhtml">Neo_Recurring_Adminhtml</Neo_Recurring>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

But still the controller is not getting overriden, also this is my controller definintion

<?php
require_once "Mage/Adminhtml/controllers/Sales/OrderController.php";
class Neo_Recurring_Adminhtml_OrderController extends Mage_Adminhtml_Sales_OrderController
{

2 Answers 2

1

As you have tried to overrider

Adminhtml/controllers/Sales/OrderController

so, you OrderController.php location should be Neo>Recurring>controllers>Adminhtml>Sales

Also,you need to change the class

Neo_Recurring_Adminhtml_OrderController

to

Neo_Recurring_Adminhtml_Sales_OrderController
0
1

you need to put your controller in For Eg.

app/code/local/PA/Sales/controllers/Adminhtml/Sales/Order/CreateorderController.php

and name your class accordingly.


As a general rule, when rewriting a controller from Mage/Adminhtml/Some/Controller/HereController.php your new path should be Namespace/Module/controllers/Adminhtml/Some/Controller/HereController.php.

  • So what comes after Adminhtml in the original controller should be kept after Adminhtml in your custom controller.
3
  • Thanks for info. But I have implmented same my controller is under, Jan 3, 2017 at 4:30
  • app/code/local/neo/Recurring/Controllers/Adminhtml/OrderController.php Jan 3, 2017 at 4:31
  • I have used this for overridding the onepage controller which is present in checkout require_once 'Mage/Checkout/controllers/OnepageController.php'; class King_Expense_OnepageController extends Mage_Checkout_OnepageController Jan 3, 2017 at 4:39

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.