I have created Cart items preview it's working fine. But it is visible only in http://Ipaddress/magento/index.php/electronics/cell-phones.html. If this is visible globally how Can I modified this? and flickering( when Mouseover items are visible below grid is flickering).

my code is



class Easylife_Checkout_Block_Links extends Mage_Checkout_Block_Links

    public function addCartLink()
        $parentBlock = $this->getParentBlock();
        if ($parentBlock && Mage::helper('core')->isModuleOutputEnabled('Mage_Checkout')) {
            $count = $this->getSummaryQty() ? $this->getSummaryQty()
                : $this->helper('checkout/cart')->getSummaryCount();
            if ($count == 1) {
                $text = $this->__('My Cart (%s item)', $count);
            } elseif ($count > 0) {
                $text = $this->__('My Cart (%s items)', $count);
            } else {
                $text = $this->__('My Cart');

            $parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart" onMouseOver="$(\'Item_Card\').show();" ');
        return $this;


<catalog_category_default translate="label">       
        <reference name="content">
            <block type="catalog/product" name="catalog.product.cartlist" template="catalog/product/cartlist.phtml"/>               


<?php if(Mage::helper('checkout/cart')->getSummaryCount()>0) { ?>
    <div onMouseOver="$('Item_Card').show();" style="width: 500px; display:none;position: relative;left: 300px; top: -100px;" id="Item_Card">
        <div class="block block-cart" >

            <div class="block-title" onMouseOut="$('Item_Card').hide();">
                <strong><span><?php echo $this->__('My Cart') ?></span></strong>
            <div class="block-content" onMouseOut="$('Item_Card').hide();" >
                <?php  $cartid= Mage::getModel('checkout/cart')->getProductIds();

            /*    $_helper = $this->helper('catalog/output');*/ ?>
                <table class="data-table" id="wishlist-table">
                            Product Image
                            Product Details
                            Edit Cart Details
                    <?php foreach ($cartid as $pid): ?>
                        <?php $pname= Mage::getModel('catalog/product')->load($pid);?>
                        <tr id="item_<?php echo $pid;?>">
                        <?php if($pname->isSaleable()): ?>
                                <td><a href="<?php echo $pname->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($pname, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($pname, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($pname, 'small_image'), null, true) ?>" /></a></td>
                                <td><label><p>Name : <b><?php echo $pname->getName(); ?></b></p><p>SKU : <b><?php echo $pname->getSKU(); ?></b></p><p>Description : <b><?php echo $pname->getDescription(); ?></b></p></label></td>
                                <td><label><b><?php echo number_format($pname->getPrice(),2); ?></b></label></td>
                                <td><a class="link-edit" href="<?php echo Mage::helper('checkout/cart')->getCartUrl(); ?>"><?php echo $this->__('Edit') ?></a></td>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                        <?php endif; ?>
                    <?php endforeach ?>
<?php }else{?>

    <div onMouseOut="$('Item_Card').hide();" style="height: 150px;width: 200px;display:none;position: relative;left: 400px; top: -100px;" id="vinod">
        <div class="block block-cart">
            <div class="block-title">
                <strong><span><?php echo $this->__('My Cart') ?></span></strong>
            <div class="block-content">
                <label><b><?php echo 'There is no items in your cart'; ?></b></label>

<?php } ?>

Can you tell me If this is visible at globally where I need to write this? and how can I solve flickering?


  • The flickering stuff is a dublicate of this one: magento.stackexchange.com/questions/15007/…. Again it's hard to understand what you try to explain. What do you mean with "visible at globally"? – thebod Feb 14 '14 at 11:54
  • @thebod, thanks for replying now working fine. – Magento Nav Feb 14 '14 at 12:04
  • @MagentoNav feel free to share your answer here as it may help other developers out. – David Manners May 21 '14 at 14:52

If you want to have this block visible on all pages of your website then you can change the layout handle from <catalog_category_default> to <default>.

There are also a couple of other things that appear odd about your code.

  1. The layout defines the block of type catalog/product but the block itself extends Mage_Checkout_Block_Links,
  2. I am fairly sure that magento has most of this functionality in the system by default, well it definitely has a cart items box that could be extended to meet your needs. See app/design/frontend/base/default/layout/checkout.xml - name="cart_sidebar"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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