Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to: Move Mini-cart to Header, Just like to one on this page? 
 
lubu
Jr. Member
 
Total Posts:  2
Joined:  2008-03-10
 

I tried moving the current mini-cart from right sidebarl to to top of the page but no success… Can someone please tell me how I can do it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Martin Ille
Jr. Member
 
Total Posts:  10
Joined:  2008-10-28
Bratislava, Slovakia
 

I need help with this also… nobody can advise pls?

 
Magento Community Magento Community
Magento Community
Magento Community
 
hienduchuynh
Jr. Member
 
Avatar
Total Posts:  9
Joined:  2008-11-05
 

In header.phtml at app\frontend\your_interface\your_theme\template\page\html\ , add the code :

<?php echo $this->getChildHtml('cart_sidebar_new'?>

And in page.xml at app\frontend\your_interface\your_theme\layout , add the code:

<reference name="header">
            <
block type="checkout/cart_sidebar" name="cart_sidebar_new" template="checkout/cart/sidebar_new.phtml" />
        </
reference>

and remove

<block type="checkout/cart_sidebar" name="cart_sidebar_new" template="checkout/cart/sidebar_new.phtml" />
in other xml.
Goodluck!
 
Magento Community Magento Community
Magento Community
Magento Community
 
cipherd
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2008-12-18
Charlotte, NC
 
hienduchuynh - 26 November 2008 06:41 PM

In header.phtml at app\frontend\your_interface\your_theme\template\page\html\ , add the code :

<?php echo $this->getChildHtml('cart_sidebar_new'?>

And in page.xml at app\frontend\your_interface\your_theme\layout , add the code:

<reference name="header">
            <
block type="checkout/cart_sidebar" name="cart_sidebar_new" template="checkout/cart/sidebar_new.phtml" />
        </
reference>

and remove
<block type="checkout/cart_sidebar" name="cart_sidebar_new" template="checkout/cart/sidebar_new.phtml" />
in other xml.
Goodluck!

You were not clear with your instructions. What do you mean remove in other xml?  That does not make any sense.  I do not see it in the page.xml so what .xml were you referring to?

 
Magento Community Magento Community
Magento Community
Magento Community
 
srinigenie
Guru
 
Avatar
Total Posts:  539
Joined:  2008-02-04
 

I think hienduchuynh was referring to checkout.xml where the mini cart is loaded on the sidebar.

@ cipherd - Would appreciate if you are more considerate of fellow forum members. ‘hienduchuynh’ is only trying to help and some kind words and appreciation would always be good.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kajal
Member
 
Total Posts:  60
Joined:  2010-06-27
 

(1)
copy the <reference name=\"left\"> code from your theme -> layout -> checkout.xml

<reference name=\"left\">
<block type=\"checkout/cart_sidebar\" name=\"cart_sidebar\" template=\"checkout/cart/sidebar.phtml\" before=\"-\">
<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\"/>
</block>
</reference>

and rename it like
<reference name=\"header\">
<block type=\"checkout/cart_sidebar\" name=\"cart_sidebar\" template=\"checkout/cart/mini.cart.top.phtml\">
</block>
</reference>
place it at above the <reference name=\"left\"> code block

(2)
now copy template -> cart -> checkout -> sidebar.php and save it in the same folder as mini.cart.top.phtml.

Thats it.

For more explanation here is my code for checkout.xml

<default>

<!-- Mage_Checkout -->
<reference name=\"top.links\">
<block type=\"checkout/links\" name=\"checkout_cart_link\">
<action method=\"addCartLink\"></action>
<action method=\"addCheckoutLink\"></action>
</block>
</reference>
<reference name=\"header\">
<block type=\"checkout/cart_sidebar\" name=\"cart_sidebar\" template=\"checkout/cart/mini.cart.top.phtml\">
</block>
</reference>
<reference name=\"left\">
<block type=\"checkout/cart_sidebar\" name=\"cart_sidebar\" template=\"checkout/cart/sidebar.phtml\" before=\"-\">
<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\"/>
</block>
</reference>
</default>

and my mini.cart.top.phtml is as

<?php $_cartQty = $this->getSummaryCount() ?>
<div class=\"items\">
<div class=\"fleft\">
<span>
<?php if ($_cartQty!=\"\"): ?>
<?php if ($_cartQty==1): ?>
<?php echo $this->__(\'No of Items: <a href=\"%s\">1 </a>\', $this->getUrl(\'checkout/cart\')) ?>
<?php else: ?>
<?php echo $this->__(\'No of Items: <a href=\"%s\">%s </a>\', $this->getUrl(\'checkout/cart\'), $_cartQty) ?>
<?php endif ?>
<?php else :?>
<?php echo $this->__(\'No of Items: 0\');?>
<?php endif;?>
</span></div>
<div class=\"fright\">
<div class=\"pad-r\">Total: <span class=\"label\"><?php echo Mage::helper(\'checkout\')->formatPrice($this->getSubtotal()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />(<?php echo Mage::helper(\'checkout\')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper(\'tax\')->getIncExcText(true) ?>)
<?php endif; ?></div>
</div>
</div>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ravi Goswami
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2010-03-11
 

@hienduchuynh,
Thanks brother. It works perfectly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
magedziner
Sr. Member
 
Avatar
Total Posts:  246
Joined:  2009-09-02
 

To move the mini-cart to header, here is example for that cart sidebar

 
Magento Community Magento Community
Magento Community
Magento Community
 
ethical
Jr. Member
 
Total Posts:  11
Joined:  2010-05-31
 

Anyone have an idea of how to NOT display the mini cart when on the checkout/shopping cart pages?
thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
ethical
Jr. Member
 
Total Posts:  11
Joined:  2010-05-31
 

ok so this is what I did to NOt display the min cart on the checkout and cart pages

I edited
/home/groovygr/public_html/app/design/frontend/default/CUSTOMTEMPLATEFOLDER/template/page/html/header.phtml

<?php if ( $_SERVER['REQUEST_URI'] == "/checkout/onepage/" || $_SERVER['REQUEST_URI'] == "/checkout/cart/" ) { ?>

<?php } else { ?>
<div class="header_mini_cart">
<?php echo $this->getChildHtml('mini_cart_top') ?>
</div>
<?php } ?>

hth someone

 
Magento Community Magento Community
Magento Community
Magento Community
 
Kaushik Patel
Jr. Member
 
Total Posts:  28
Joined:  2011-12-24
 

Check this. working great.
http://hkpatel201.blogspot.in/2012/09/moving-magento-mini-cart-to-header.html

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top