Overriding Magento core

Posted on October 12, 2012 by Nimrod Techn There have been 0 comments

Repeat after me. we never, ever, ever, ever - change Magento's core files (app/code/core).

Why? lots of reasons. the most important one is, we would like to upgrade our Magento system at some point.

The best of practices would be to create a directory in app/code/local named Mage (app/code/local/Mage).

Now copy the core file to the exact same directory hierarchy (create the same hierarchy), on local.

 

Which means, if the file we would like to copy is at app/code/core/Mage/catalog/controllers/IndexController.php, we would copy it to app/code/local/Mage/catalog/controllers/IndexController.php.

Blocks, controllers, helpers - can be copied like this without a problem.

Models, however, require you to develop a Magento extension with slight modifications.

 

 


This post was posted in Writing a Magento Extension

Magento is a well-engineered eCommerce platform designed to help engineers develop customized eCommerce online stores. Due to lack of proper coding documentation, Engineer-ing.com was created with the sole purpose of instructing Magento developers to-be with the "how-to-do" know-how. In the event of unresolved issues, you are more than welcome to contact me for consultation. However, please do so only if you possess a Software Engineering background and you're able to specify your question.