How can I move my cart into my navigation instead of the header?
-
29-09-2020 - |
Question
No one seems to have the answer to this. I literally just want to move my cart from the default header position in the RWD theme into my navigation instead. How can this be done? thank you
Solution
You will need to do a bit of restyling with CSS and possibly make HTML changes to the cart template but here is how you can move the cart to the end of the navigation in Magento RWD theme.
In your theme's layout file add the following:
<default>
<reference name="header">
<action method="unsetChild">
<name>minicart_head</name>
</action>
</reference>
<reference name="catalog.topnav">
<action method="insert">
<name>minicart_head</name>
</action>
</reference>
</default>
This will move the block from the header block into the navigation block. You then need to copy the template "page/html/topmenu.phtml" into your theme and output the "minicart_head" child block within an li.
<?php $_menu = $this->getHtml('level-top') ?>
<?php if($_menu): ?>
<nav id="nav">
<ol class="nav-primary">
<?php echo $_menu ?>
<li class="header-minicart">
<?php echo $this->getChildHtml('minicart_head'); ?>
</li>
</ol>
</nav>
<?php endif ?>
See below screenshot of it working in RWD. As mentioned you will need to make some CSS changes.
OTHER TIPS
Put below code in your catalog.xml
layout file where navigation layout is defined or wherever you want to show the header cart details.
<block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
<action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/minicart/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/minicart/default.phtml</template></action>
<block type="core/text_list" name="cart_sidebar.cart_promotion" as="cart_promotion" translate="label" module="checkout">
<label>Mini-cart promotion block</label>
</block>
<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>