Friday, September 13, 2013

Product Sold quantity display in your view page in magento.

<?php
$sku = nl2br($_product->getSku());
$_productCollection = Mage::getResourceModel('reports/product_collection')
    ->addOrderedQty()
    ->addAttributeToFilter('sku', $sku)
    ->setOrder('ordered_qty', 'desc')
    ->getFirstItem();
$product = $_productCollection;

echo 'Already sold '.(int)$product->ordered_qty;
?>

No comments:

Post a Comment

Please mention your comments.......