Please enter name
please enter valid email
please enter comment
Please enter correct code

Customizing Magento Core files

Contributed by Vinci Rufus on 2 Sep 2011

As a part of your Magento implementation more often than not you will need to modify some of the core Magento files.

Most novices and even regular Magento developers resort to directly making changes to the php files located under the \app\code\core\Mage. This is a wrong practice because in future if you upgrade your Magento version all these custom code that you have written would be over written.

 

The right way to do it would be to replicate that particular file’s path within the \app\code\local folder and and make the custom changes in that file. For example if you want to make changes to Onepage.php located at \app\code\core\Mage\Checkout\Block\Onepage.php, what you would need to do is copy and paste the Onepage.php file replicating the folder structure within the local folder as follows \app\code\local\Mage\Checkout\Block\Onepage.php and make the necessary changes in this file.

The way it works with Magento is, Magento will first look for custom files located within the ‘local’ folder and only if its not present it will use the files located within the ‘core’ folder. Also at the time of upgrading Magento only files located within ‘core’ will get updated, ensuring that any custom coding written  in files within the ‘local’ folders remains untouched.

 

Visit us at Neevtech.com to know more about our offerings.

Leave a Comment

Security Code: