Magento – Magento Rewrite Community controllers

admincontrollersmagento-1.8overrides

I have checked Overriding community adminhtml controllers but all are not working.
Related questions:
override community controller in local codepool. Rewrite controller magento

I have to rewrite the adminhtml controllers in the Path:

community/Magestore/Slider/controllers/Adminhtml/SliderController.php

to My Local path:

local/Mymodule/Slider/controllers/Adminhtml/SliderController.php

My Config.xml:

<admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <Mymodule_Slider before="Magestore_Slider_Adminhtml">Mymodule_Slider</Mymodule_Slider>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>

SliderController.php

require('Magestore/Slider/controllers/Adminhtml/SliderController.php');

class Mymodule_Slider_Adminhtml_SliderController extends Magestore_Slider_Adminhtml_SliderController
{
    public function indexAction()
    {
        echo '1';die();
    }
}

it is not coming into the Slider controller overridden in the local. What was wrong with my code ?
Thanks

Best Answer

I think your config your be the following:

<admin>
    <routers>
        <adminhtml>
            <args>
                <modules>
                    <Mymodule_Slider before="Magestore_Slider_Adminhtml">Mymodule_Slider_Adminhtml</Mymodule_Slider>
                </modules>
            </args>
        </adminhtml>
    </routers>
</admin>

Since your controller is called Mymodule_Slider_Adminhtml_SliderController then I think the section of your config.xml should match and be Mymodule_Slider_Adminhtml.

Related Topic