Magento 1.8 – How to Undo Layout Update in local.xml

layoutlocal.xmlmagento-1.8

I have a third party extension that is using an update handle on a few key pages that i'd like to remove:

<cms_page>
    <update handle="handle_name1" />
    <update handle="handle_name2" />
    <update handle="handle_name3" />
</cms_page>

Is there a way to remove these layout updates using local.xml? I am trying to avoid doing the "copy the layout file to my theme" bit.

Best Answer

As far as I know, this facility is not available with magento by default. You cannot remove a layout handle which has added to the layout via another layout update file.

When we perform an update handle inside anther layout handle as you shown above, what magento does is, it will update the layout by including the blocks which are defined inside the update handle along with existing blocks in the layout. So when we come to local.xml file, the update handle has no relevance at all. It made its effect by updating the layout tree with its defined blocks.

So the only thing, that you can do is remove blocks which are added via these update handles. However you need to be really care about this step. Because update handle may contain blocks which are using by magento layout in different section. You should not remove these blocks via local.xml. But you can surely remove custom blocks which are specific to the third party extension if that block content is not at all necessary. You can do this like below.

File : app\design\frontend\<package>/<theme>/layout/local.xml

<layout>
    <default>
        <remove name="name_of_custom_block_1 />
        <remove name="name_of_custom_block_2 />
        <remove name="name_of_custom_block_3 />
        .....
   </default>
</layout>

You need to fill the remove section by adding all of the custom blocks which are included via update handles.