1

y'all. What is the best way to achieve this epic feat of intellectual prowess?

Is this a good start?

require_once("mage/Adminhtml/controllers/Catalog/ProductController");
class Company_adminhtml_Catalog_ProductController extends Mage_AdminhtmlCatalog_ProductController{
    ....
}

From that point, what else must be achieved?

2 Answers 2

3

In your controller

require_once 'Mage/Adminhtml/controllers/Catalog/ProductController.php';   
class Company_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController {

}

In your config.xml

<config>
    ....
    <admin>
          <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Company_Adminhtml before="Mage_Adminhtml">Company_Adminhtml</Company_Adminhtml>
                    </modules>
                </args>
            </adminhtml>
          </routers>
      </admin>
</config>

See Magento: Overriding Core Files (Blocks, Models, Resources, Controllers)

1

Magento won't find the controller as it would search for Mage/Customer/AccountController.php. I guess the only way is in fact require_once a controller php class file.

I think here you can find a complete solution for this.

The other, much less elegant way is to copy the whole controller you want to extend, and let it extend Mage_Core_Controller_Front_Action.

Edit: Or Mage_Adminhtml_Controller_Action for admin area controller.

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.