Moving Magento mini-cart To Header

Moving Mini-cart to header in magento is really simple you just need to change your xml and place the magento getChildHtml() function in header section and you are done with it. below are steps by which we can move mini cart.

Step1. Open checkout.xml from location given below

/design/frontend/default/default/layout/checkout.xml

find the code below in file.
[xml]
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml"/>
[/xml]
Step2. now open page.xml can be found at location given below

\design\frontend\default\default\layout\page.xml

in this file find the code given below
[xml]
<block type="page/html_header" name="header" as="header">
[/xml]
paste the the cart_sidebar block as shown below.

[xml]
<block type="page/html_header" name="header" as="header">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>

<!–new added block –>
<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"/>

</block>
[/xml]

clear your var/cache folder and check you are done

Leave a Comment

Your email address will not be published. Required fields are marked *

*