Ina Code Blog

bunch of code in one place
« Magento: how to display a certain attribute?
Website for Hotel Tartini Piran »


Jun
10

Magento: How to move cart block from sidebar to header?

Posted by admin in Magento

Open file: /app/design/frontend/your_theme/your_theme/template/page/html/header.phtml and add this line where you want the cart block to be displayed:

<?php echo $this->getChildHtml(’cart_sidebar_head’) ?>

Open file: /app/design/frontend/your_theme/your_theme/layout/page.xml and insert this in block type page/html_header:

<block type=”checkout/cart_sidebar” name=”cart_sidebar_head” template=”checkout/cart/sidebar.phtml” />

You probably don’t need cart block in you sidebar anymore so open file: /app/design/frontend/your_theme/your_theme/layout/checkout.xml and remove or comment these lines:

<block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.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>

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

2 Responses to “Magento: How to move cart block from sidebar to header?”

  1. Added by simon on Dec at 4

    hi, i tried it but nothing appears. maybe because i have my own template? thanks

  2. Added by admin on Dec at 9

    You put this code in your template files. You have to replace all the ” with normal ones, I have some problems displaying ” on my blog…sorry…

Leave a Reply

Comment