Get product collection of wishlist magento
Put the below code in anywhere of your site and get the collection of customer wishlist.
<?php
$customer = Mage::getSingleton('customer/session')->getCustomer();
if($customer->getId()){
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true);
$wishlistItems = $wishlist->getItemCollection();
}else{
$wishlistItems = array();
}
?>
<?php if(count($wishlistItems) > 0): ?>
<div class="checkout_body" style="padding: 8px;">
<ul class="order_summ">
<?php foreach ($wishlistItems as $item): ?>
<?php $_product = Mage::getModel('catalog/product')->load($item->getProduct()->getId()); ?>
<li>
<div class="cart_product">
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize(74,97); ?>" alt="" class="img-responsive">
</div>
<div class="cart_product_desc">
<div class="name_ellipsis"><a href="<?php echo $_product->getProductUrl() ?>"><?php echo $_product->getName(); ?></a></div>
<div>Quantity : <?php echo $item->getQty(); ?></div>
<div>Unit Price : <span class="unit_price"><?php echo Mage::helper('core')->currency($_product->getFinalPrice(),2); ?></span></div>
</div>
<div class="cart_product_edit">
<button onclick="setLocation('<?php echo $this->helper('wishlist')->getRemoveUrl($item); ?>')">
<img src="<?php echo $this->getSkinUrl("images/delete_icon.png"); ?>" />
</button>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php else: ?>
<div style="padding: 8px;" class="checkout_body">
There are no products in the wishlist.
</div>
<?php endif; ?>
No comments:
Post a Comment