Magento – Move breadcrumb Block purely via local.xml

layout

I want to move the breadcrumb block purely using local.xml.

It needs to be moved from its default location to the content block somewhere for me to output.

Usually when moving blocks i would unsetChild and then insert, however, this is making the breadcrumb block appear twice and also its not actually moving it anywhere.

<reference name="root">
    <action method="unsetChild"><name>breadcrumbs</name></action>
    <reference name="content">
        <action method="insert"><child>breadcrumbs</child></action>
    </reference>
</reference>

Best Answer

This is a good exercise - a good chance to learn. Because a layout XML move in Magento 1 is really a composite operation (unser from original parent, add to new parent), debugging requires testing both conditions.

The insert is obviously working, as you are seeing the breadcrumbs block twice. That means that the unsetChild call is not working. This is almost always the result of one of two things: incorrect child alias or incorrect parent reference. In your case, it is the latter. This is the result of a custom (non-CE) theme; for example, the enterprise/default theme declares the breadcrumbs block in a core/text_list block named breadcrumbs.container.

Also, reference tags should not be nested. They will work when nested, but given that they operate against the global block list by name, it's not necessary.