Magento - local controller is not working

Moon picture Moon · Sep 28, 2010 · Viewed 7k times · Source

I have a question regarding Magento's local directory.

I am trying to override a core controller - Mage/Contacts/controllers/IndexController.php.

So I copied IndexController.php to /app/local/Mage/Contacts/controllers/

but Magento is still using core file. I can confirm it because I see 404 page when I rename Mage/Contacts/controllers/IndexController.php to IndexController.php_.

Please advise me.

Thanks!

Answer

Jonathan Day picture Jonathan Day · Sep 28, 2010

Copying a controller into the app/code/local path doesn't work unfortunately due to Magento's autoload architecture. It does work with Blocks, Models and other objects, but not controllers.

There is a detailed walkthrough of how to override a controller on the wiki. And a blog post by @prattski

Try following those, then come back with any specific questions.

HTH, JD