Is it possible to move the Cart block from the sidebar to the header, ONLY with the local.xml file?

This is not working:

<reference name="right">
    <action method="unsetChild"><alias>cart_sidebar</alias></action>
<reference name="header">
    <action method="insert"><blockName>cart_sidebar</blockName></action>

No. the header.phtml also needs a getChildHtml call. An option would be to add it to <reference name="content"> and use CSS to position the block on the header.

Your local.xml would look something like this

<reference name="content">
    <block type="checkout/cart_sidebar" name="cart_header" template="checkout/cart/header.phtml" before="-">
        <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
        <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
            <label>Shopping Cart Sidebar Extra Actions</label>
<reference name="right">
   <remove name="cart_sidebar"/>
  • Thanks, but it's not working... :( – user3310748 Apr 2 '14 at 14:35
  • can you give a little more information? What's happening exactly. could it be cache? might it be a templating issue? – Sander Mangel Apr 2 '14 at 14:57

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.