cancel
Showing results for 
Search instead for 
Did you mean: 

Cart in sticky menu

SOLVED

Cart in sticky menu

Hello,

I've successfully placed my cart into a sticky menu, however, the carts item quantities and total are not updating as products are added to the cart like the cart that is located in the header of the site.

what's missing??? 

<li>
<?php $store = Mage::app()->getStore();
$code  = $store->getCode(); ?>
<?php $favEn = (Mage::getStoreConfig('legenda_setting/general_settings/favicon',$code) == 1)?'enable':'false'; ?>
<div class="shopping-cart a-right" data-fav-badge="<?php echo $favEn?>">
<?php $_cartQty = $this->getSummaryCount();
    if (!$_cartQty)
        $_cartQty = 0; ?>
    <div class="cart-sum" data-items-count="<?php echo $_cartQty ?>">
        <a href="<?php echo $this->getUrl('checkout/cart') ?>">
            <strong><?php echo $this->__('Cart')?></strong> <span class="items"><?php echo $_cartQty.$this->__(' item(s)') ?></span>
            <span class="for-label"><?php echo $this->__('for')?></span>
            <span class="price"><?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?></span>
        </a>
    </div>
    <div class="cart-popup-container">
        <div class="cart-popup">
            <?php $_items = $this->getRecentItems() ?>
            <?php if(count($_items)): ?>        
                <div id="cart-sidebar" class="products-small">
                    <?php foreach($_items as $_item): ?>
                        <?php echo $this->getItemHtml($_item) ?>
                    <?php endforeach; ?>
                </div>        
                <script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script>
                <div class="subtotal">
                    <?php echo $this->__('Total: ') ?>
                    <span class="price"><?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?></span>
                </div>
                <a href="<?php echo $this->getUrl('checkout/cart') ?>" class="button left"><?php echo $this->__('View Cart') ?></a>
            <?php else: ?>
                <p class="empty a-center"><?php echo $this->__('No products in the cart.') ?></p>
            <?php endif ?>        
            <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
                <button type="button" title="<?php echo $this->__('Checkout') ?>" class="button filled right" onclick="setLocation('<?php echo $this->getCheckoutUrl() ?>')"><span><span><?php echo $this->__('Checkout') ?></span></span></button>        
            <?php endif ?>
        </div>
    </div>
</div>                        
 </li>

 

 

3 REPLIES

Re: Cart in sticky menu

Can anyone tell me what direction i need to look for some guidance?

What is a probable cause for the quantity of the cart not to be functioning properly?

anyone?

 

~B.

Re: Cart in sticky menu

Your way is not very clean. I will give you better solution.

 

<?php echo $this->getLayout()->createBlock('checkout/cart_sidebar')->setTemplate("checkout/cart/sidebar.phtml")->toHtml(); ?>

 

Put this into your header template. If you want custom design you have to edit sidebar.phtm template.

Re: Cart in sticky menu

Daniel !!!! thank you so very very much. Smiley Very Happy