There are two "levels" of correctness for fixing your core hacks.
The first is to use the
local code pool. Whenever Magento instantiates an object (except for controller objects, which are different), it looks for a class file in four different locations.
Core files are in the
core code pool. You'll want to move your files there. So if you edited
You would want to copy the file to
and then restore the original
That's code pool overrides. The benefit of a code pool override over a core hack is it allows you to keep track of what changes you've made, and your changes won't be lost when you upgrade the system.
True Magento Modules and Class Rewrites
Code pool overrides aren't perfect. When you upgrade Magento, you still need to merge changes to the core files with your own, and this can be tricky if a file's changed extensively.
The best approach to use is a class rewrite. The high level steps involved here are
- Create a Magento module
- Identify the "class alias" for your block, model, and helper (such as
- Add configuration to
config.xml that tells Magento "When you instantiate a
catalog/product object, use my class instead".
- In your class redefine only the methods you want, and (based on your needs), call the original method with the
The above is more involved, but it will decrease the likelihood of your customizations breaking updated versions of Magento, and by putting your changes in a module, you can distribute it easily to any Magento system. The how/why of creating a class rewrite is beyond the scope of a single Stack Exchange answer, but there's plenty of tutorials out there on how to do it, and the community here is more than willing to help a motivated developer figure it out.