user635818
user635818

Reputation: 99

Magento extend core admin controller

First day with Magento.

Trying to extend an admin controller "Mage_Adminhtml_Sales_Order_EditController" with "SF_Teams_Adminhtml_Sales_Order_EditController"

I've been trying Google examples for 5 hours now, and my brain is bleeding...

Can some one please help with the config.xml code? (means, do it for me)

Thanks a lot.

Upvotes: 2

Views: 1829

Answers (1)

benmarks
benmarks

Reputation: 23205

For general information on adding routes to Adminhtml you can refer to Mage_Widget config.xml.

You need to do two things to accommodate standard route collection in Magento: 1) add a directory to the list of directories for a module's controller and 2) match the route pattern by naming your controller class and action just as the original is defined.

Necessary config:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <your_dir before="Mage_Adminhtml">SF_Teams_Adminhtml</your_dir>
</ ... >

See the standard router's collectRoutes() method as a reference.

Then in your controller file at SF/Teams/controllers/Adminhtml/Sales/Order/EditController.php, you may or may not extend from the original class and override (determined by what you need from the parent class). If so, you need to include the original class file before the class definition, as the system cannot autoload the original file.

Upvotes: 4

Related Questions