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

Moving the Sidebar Cart to a Different Location
 
Borduhh
Member
 
Avatar
Total Posts:  40
Joined:  2010-09-14
Rochester, NY
 

I have seen a couple threads on moving the sidebar cart to the header, but I am having a little trouble moving it to my navigation bar. I currently have the pronav extension installed to customize the navigation layout and I would like to add the sidebar cart to that bar.

Right now I have this code in the pronav.xml file:

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <
reference name="head">
            <!-- 
Remove googleapi.jquery.js  if jQuery has been already loaded -->
            <
action method="addJs">
                <
js>pronav/jquery.1.4.2.js</js>
            </
action>
            <
action method="addJs">
                <
js>pronav/jquery.hover.intent.js</js>
            </
action>
            <
action method="addCss">
                <
stylesheet>pronav/css/pronav.demo.css</stylesheet>
            </
action>
            <
action method="addItem"><type>skin_css</type><name>pronav/css/pronav.patches.ie7.css</name><params/><if>lt IE 7</if></action>
            <
action method="addItem"><type>skin_css</type><name>pronav/css/pronav.patches.ie8.css</name><params/><if>lt IE 8</if></action>
        </
reference>
        <
reference name="top.menu">
            <
remove name="catalog.topnav" />
            <
block type="catalog/navigation" name="pronav.topnav" template="pronav/navigation_top.phtml" />
        </
reference>
    </default>
    <
pronav_index_index>
        <
reference name="content">
            <
block type="pronav/pronav" name="pronav" template="pronav/pronav.phtml"/>
            <
block type="checkout/cart_sidebar" name="cart_sidebar" as="header_cart" template="checkout/cart/header_cart.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" translate="label" module="checkout">
                    <
label>Shopping Cart Sidebar Extra Actions</label>
                </
block>
            </
block>
        </
reference>
    </
pronav_index_index>
</
layout>

As well I have this in my navigation_top.phtml file:

<div id="header_cart">
    
<?php echo $this->getChildHtml('header_cart')?>
</div>

Plus I have this code in my header_cart.phtml file:

<?php if ($this->getIsNeedToDisplaySideBar()):?>
<div class="block block-cart">
    
<?php $_cartQty $this->getSummaryCount() ?>
    
<div class="block-title">
        <
class="heading" href="<?php echo $this->getUrl('checkout/cart') ?>" title="View your shopping cart">My Cart</a>
        
<?php if ($_cartQty>0): ?>
            
<div class="summary">
                
<?php if ($_cartQty==1): ?>
                    
<class="amount"><?php echo $this->__('<a href="%s">Cart (1)</a>'$this->getUrl('checkout/cart')) ?></p>
                
<?php else: ?>
                    
<class="amount"><?php echo $this->__('<a href="%s">Cart (%s)</a>'$this->getUrl('checkout/cart'), $_cartQty?></p>
                
<?php endif ?>
                
<a href="/index.php/checkout/cart/" class="subtotal">
                    
<?php if ($this->canApplyMsrp()): ?>
                        
<span class="map-cart-sidebar-total"><?php echo $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER'); ?></span>
                    
<?php else: ?>
                        <?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; ?>
                    <?php 
endif; ?>
                
</a>
                <
div class="checkout_link">
                    <
a href="/index.php/checkout/onepage/" title="Proceed to checkout">Checkout</a>
                </
div>
            </
div>
        
<?php else: ?>
            
<div class="summary">
                <
class="empty"><?php echo $this->__('Your cart is empty'?></p>
            </
div>
        
<?php endif ?>
    
</div>
</
div>
<?php endif;?>

But for some reason the method is not working correct. The files are located:

1. custom-template/layout/pronav.xml
2. custom-template/template/pronav/navigation_top.phtml
3. custom-template/template/checkout/cart/header_cart.phtml

Any suggestions on what might be going wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Borduhh
Member
 
Avatar
Total Posts:  40
Joined:  2010-09-14
Rochester, NY
 

Solved.

The problem was the the cart block had a

before:"-”

tag in the pronav.xml file. It is the simplest problems that give us trouble.

 
Magento Community Magento Community
Magento Community
Magento Community
 
CheckMater
Jr. Member
 
Avatar
Total Posts:  7
Joined:  2012-03-24
 

smile always happen!

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