Move mini-cart in the sidebar to the header (or anywhere) in Magento

  • minicart in

Hi all – Here is my solution to a question I’ve seen asked many times: How to move the cart sidebar into the header area. You can use this technique to move it anywhere. This is not the only way to do this, but it is a useful one.

1) Copy the the block for the cart side bar:

01.//design/frontend/default/default/layout/checkout.xml
02.
03.
04.//there is also this full code in my version 1.1.3
05.
06.simplecheckout/cart_item_renderercheckout/cart/sidebar/default.phtml
07.groupedcheckout/cart_item_renderer_groupedcheckout/cart/sidebar/default.phtml
08.configurablecheckout/cart_item_renderer_configurablecheckout/cart/sidebar/default.phtml
09.
2) Open up app\design\frontend\default\default\layout\page.xml (assuming you are using the default design or didn’t create a new page.xml file in your own templates)
Find the code :
1. //near line 58
Within that block, you will see other sub-blocks.
Paste your new block in there. Add the “as” attribute and set it to “topcart” — final result:
1.
2.
3.
4.
5.
6.
7.

3) Finally, go into app\design\frontend\default\default\template\page\html\header.phtml (again, assuming your using default theme) and add the code:
1.//place this where ever you want the cart to show up.
2. getChildHtml(‘topcart’); ?>
Quick update:
Removing the cart in a CMS page would also be handy to know:
In the Update Layout XML area, use:
You might have  to wrap this in (name changing dependent on your design)

1.cart_sidebar

Comments Closed