0

I am editting the magento installation that another developer set up (Badly).

I have notice in the local code pool, the Mage directory with catalog/list.php

I assume this is to override magento's core mage/catalog.

It seems quick and easy but is this best practice? Are there any possible drawbacks? It seems kind of dirty.

1 Answer 1

1

Sometimes it is quicker and easier to copy the core files to the local pool to override, rather than having to write a full module. Yes, it is dirty and it all depends on what reason you have to do it in the first place.

Of course, when the system is updated, one should check if the original of this file has significant changes in it you may need to appy to your local copy.

Here is more explanation of the matter:

http://magebase.com/magento-articles/when-should-you-override-magento-core-files-in-app_code_local_mage/

4
  • 1
    So you're saying it's wrong to do this for long fixes/changes as when an update happens they won't apply to your local code which now takes precedence meaning that if bug fixes/improved functionality were applied to the original classes that you have over-ridden they won't be run therefore leaving your version incomplete?
    – Eujinks
    Commented Jan 25, 2016 at 14:49
  • Yes, that is exactly it. I do it every now and again myself, but usually only to check things prior to writing it in a module.
    – tecjam
    Commented Jan 25, 2016 at 14:51
  • Okay that makes sense now that I think about it! I'll accept your answer when it lets me as this is useful for the exchange :)
    – Eujinks
    Commented Jan 25, 2016 at 14:52
  • When you use app/code/local/Mage to overload, you have to include the whole file and all the functions contained in it even if it was only a one line change. It's best to use this as a temporary measure to test, then convert this to a module that will then only overload only the function you wanted to change. It makes maintenance on upgrade go a lot easier when you have to do code refactors so your modifications work with the new Magento version. Commented Jan 25, 2016 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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