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
magento\app\code\local\Easylife\Checkout\Block\Links.php
<?php
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->removeLinkByUrl($this->getUrl('checkout/cart'));
$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart" onMouseOver="$(\'Item_Card\').show();" ');
}
return $this;
}
}
magento\app\design\frontend\base\default\layout\catalog.xml
<catalog_category_default translate="label">
<reference name="content">
<block type="catalog/product" name="catalog.product.cartlist" template="catalog/product/cartlist.phtml"/>
</block>
</reference>
</catalog_category_default>
magento\app\design\frontend\base\default\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>
<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">
<thead>
<tr>
<th>
Product Image
</th>
<th>
Product Details
</th>
<th>
Price
</th>
<th>
Edit Cart Details
</th>
</tr>
</thead>
<tbody>
<?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; ?>
</tr>
<?php endforeach ?>
<tbody>
</table>
</div>
</div>
</div>
<?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>
<div class="block-content">
<label><b><?php echo 'There is no items in your cart'; ?></b></label>
</div>
</div>
</div>
<?php } ?>
Can you tell me If this is visible at globally where I need to write this? and how can I solve flickering?
thanks.