Magento 1.8.1 – How to Move Cart to Header

cartheadershopping-cart

TOPIC:
Looking to move Shopping Cart to Header-Right in Magento 1.8.1

ATTEMPTS + OTHER POSTS:

How to add a Cart Icon to header?

Move Cart to Header in Magento 1.7

Any contribution is greatly appreciated.

Shopping Cart Icon & # Of Products In Cart – DISPLAYED AT RIGHT-HEADER is the end goal.

Best Answer

  1. in yourTheme/layout/local.xml
<layout>
<default>    
<!-- Unset cart from sidebar -->    
    <reference name="right"><action method="unsetChild"><name>cart_sidebar</name></action></reference>
    <!-- Insert cart in header -->
    <reference name="header"><action method="insert"><blockName>cart_sidebar</blockName></action></reference>
</default>
</layout>
  1. in yourTheme/template/page/html/header.phtml:
// This is required to show the cart
<?php echo $this->getChildHtml('cart_sidebar'); ?>

Normaly the cart should appear in the header.

Edit yourTheme/template/checkout/cart/sidebar.phtml to give the look you want.

Related Topic