Magento - add sidebar mini cart on the header

Posted by Damodar Bashyal on October 05, 2011

 

Do you want to move magento's sidebar mini cart to header? If you said "yes' then follow the following post. We are just using exisitng sidebar mini cart and modified to display on the top header. We have removed some of the Magento's code from the cart which we didn't need in our case, if you need it you can re-include from sidebar's phtml file that comes with magento e-commerce's base template.

Add below code inside <default> on checkout.xml:

app\design\frontend\your-package\your-template\layout\checkout.xml

<reference name="header">
	<block type="checkout/cart_sidebar" name="cart_cartheader" template="checkout/cart/cartheader.phtml" before="-">
    	<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/cartheader/default.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/cartheader/default.phtml</template></action>
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/cartheader/default.phtml</template></action>

        <block type="core/text_list" name="cart_cartheader.extra_actions" as="extra_actions" translate="label" module="checkout">
        	<label>Shopping Cart Cartheader Extra Actions</label>
    	</block>
	</block>
</reference>

More»

QR Code: Magento - add sidebar mini cart on the header