magento 1.9 correct way to extend Mage_Adminhtml_Catalog_ProductController

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?

Solutions

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.

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)

Similar questions

Correct way to change the magento 1.9 admin url
Correct way to change the Magento 1.9 admin url anyone can provide me the correct way. I see a lot of different suggestion online.
What is the correct way/approach to modify a Magento template?
Please suggest me the right approach, I want to customize the "EMAIL to Friend" page into pop up window, when user click on the button (email this product). By enabling template hinting, I found out that the button is rendered with frontend/rwd/default/template/catalog/product/view/sharing.phtml And the corresponding layout file is catalog.xml (in ...
What is the correct way to properly register & run automated cronjobs in Magento 2?
I'm trying to define a cronjob for a custom module, but having a hard time going through the proper flow of scheduled cronjobs. Few things of note:
What is the correct way to change order status in Magento 2
After placing an order, my module calls an external API. If success from external API, I need to update the order status. I know how to update status in Magento 1 but how do you do this in Magento 2? Thanks
Magento 2 - Correct way of Module Installation
Trying to install sample module in Magento 2 from this. Below is the module structure app/code/NameSpace/Module/ module.xml composer.json Registration.php Executing below command to enable module It says there are no commands defined in the "module" namespace. Also on frontend it throws below exception. I am using composer but not github. Fatal err...
Magento 2 - What is the correct way to change default Order Id?
Magento 2. After fresh install the new Order id will be 100000001, 100000002 and so on. What is the correct way to change that increment id so it would be a higher number? For example 155555552, 155555553 and so on. When changed it will look much better. In Magento 1.9 To edit default Id for Orders, Invoice or Shipment we simply had to change value...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.