1

I'm preparing my installation of 1.8 to upgrade to the latest. Over the past year I've had a few different developers assist me and even though I ask them not to modify core code, some do anyway.

I've done a search for any files modified past the installation date and have come across a few that need to be preserved.

Question

If file /code/core/Mage/CatalogSearch/Block/Result.php has been modified, my understanding is that to protect this from the upgrade I need to move it /code/local/Mage/CatalogSearch/Block/Result.php ?

Is moving modified core code to the /app/code/local the correct way to protect modified files from upgrades?

  • I think rewriting it is better, what is mean by clarification? – TBI Infotech Aug 16 '14 at 10:50
2

Yes, magento will take the class from the local folder. But it could lead to a wrong magento behavior, because the new version may assume the class has a new methods. And the old version does not have them.

I recommend you run diff command to see the changes an move them into a separate extension class, that extends the core one. This allows to use new features an do not lost the modifications.

  • Thanks for the quick answer, forgot to mention in my question: The same goes for /app/locale any files modified go into the active theme so /app/design/frontend/default/ACTIVE_THEME/local correct? – SR_Magento Aug 16 '14 at 11:07
  • For the templates just copy them to the active theme. There is no "local" folder for .phtml files, but for small changes there is local.xml layout. – Amasty Aug 16 '14 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.