Magento: Overriding Contacts controller does not work

337 Views Asked by At

I am trying to override the Mage_Contacts_IndexController in my module. This is my config.xml file:

<config>
<modules>
    <Magex_Corecontrollerextend>
        <version>0.1.0</version>
    </Magex_Corecontrollerextend>
</modules>
<frontend>
    <routers>
        <contacts>
            <args>
                <modules>
                    <magex_corecontrollerextend before="Mage_Contacts">Magex_Corecontrollerextend</magex_corecontrollerextend>
                </modules>
            </args>
        </contacts>
    </routers>
</frontend>
</config>

I also added the controller, this is the code:

require_once Mage::getModuleDir('controllers', 'Mage_Contacts') . DS . 'IndexController.php';

class Magex_Corecontrollerextend_IndexController extends Mage_Contacts_IndexController {
    public function postAction() {
        echo 'override working!';
        die();
    }
}

It is placed in Magex/Corecontrollerextend/controllers/IndexController.php. The module is enabled but the override is just not working, it always calls the controller in the core. I also cleared the cache. What could be the problem? Its Magento 1.9.

Thanks!

0

There are 0 best solutions below