When explaining the local.xml
Layout file, you’ll hear Magento veterans (myself included) explain that local.xml
is loaded last, so the updates there always “win”.
This is true, to an extent, but there’s one big caveat to keep in mind. Layout Update XML Fragments are loaded and applied in order, by handle. That means all the <default/>
update fragments, including those in local.xml
, will be applied before any others, so something like this in local.xml
<default>
<reference name="category.products">
<block type="some/block" name="adding_a_block"/>
</reference>
</default>
won’t work. That’s because the block you’re trying to reference (category.products
) doesn’t exist yet. It’s not added to the layout until the handle catalog_category_default
runs.