3

What are the advantages (or disadvantages) of using local.xml to modify a block (or something else) instead of editing a specific page (ie. catalog.xml or something else)? When to use which?

I'm asking because here on magento stackexchange it kind of varies from question to question.

3

using local.xml is a common and good practice but has some disadvantages:

  • Based on how the fallback model works, only one local.xml file will be processed in any hierarchy
  • If a design package has a default theme and multiple theme variants, this may be less desirable
  • Common elements in the local.xml file must appear only once or must be replicated in a local.xml for each theme

The best solution should be creating a "Module" with Only Frontend Components:

  1. Declare a new module.
  2. Create a config file for the new module that adds the layout file to the list of module layout files.
  3. In the base customization theme, create this new layout file that will contain common layout customizations.
  4. Create local.xml files in each theme as needed to contain theme- specific customisations.

Source: Core Principles for Theming in Magento

| improve this answer | |
2

You should avoid editing page specific xml files.

Magento has made it very easy to update layout xml through the use of a local.xml file which is the very last xml file to run.

Page Specific xml files are good for new features and pages.

Local XML is best used for overriding core Magento layouts in your custom theme. This also makes maintaining your custom theme more manageable.

| improve this answer | |

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.