2

I’m having trouble in moving the mini cart from sidebar to header. I’ve tried all the tutorials available in the internet but it doesn’t work.

I also tried adding this in the header block of layout\page.xml

<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"

And then in my page\html\header.phtml, I use the code below to call the cart but nothing happened.

<?php echo $this->getChildHtml('topcart'); ?>

The solution above works in magento 1.6, but not in version 1.7

Thanks in advance guys

0

2 Answers 2

2

In Local.xml add this :

<reference name="header">
            <!-- add cart to header -->
            <block type="checkout/cart_sidebar" name="header-cart" template="checkout/cart/header-cart.phtml">
                <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 type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
                    <label>Shopping Cart Sidebar Extra Actions</label>
                </block>
            </block>
        </reference>

In header.phtml add this :

<?php echo $this->getChildHtml('header-cart'); ?>
1

Please see post:

Move Cart to Header In Magento 1.8.1

" (1) In yourTheme/template/page/html/header.phtml:

//Place following code where you want Cart to show:
<?php echo $this->getChildHtml('cart_sidebar'); ?>

" "Please copy and paste base/default/layout/checkout.xml into YOURTHEME/layout. Then rename

<reference name="right"> 
 with 
<reference name="header">"

"Normaly the cart is not in right column anymore. Also the cart should appear in the header if you still have getChildHtml('cart_sidebar'); ?> in header.phtml"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.