By default magento does not show sold product count. if we want to show the sold product count in product description page than we need to do custom work . This Magento Blog or Magento Tutorial will tell you how to show sold product in product description page.
<?php
$items = Mage::getModel('sales/order_item')
->getCollection()
->addFieldToFilter('product_id', $_product->getId());
if ($_product->isAvailable()){
$ga_cnt = 0;
foreach ($items as $item) {
$ga_cnt += $item->getQtyOrdered() - $item->getQtyCanceled() - $item->getQtyRefunded();
}
if($ga_cnt > 0){
echo $ga_cnt.' people have purchased this product';
} else {
echo 'Be the first to buy this product!';
}
} else {
echo 'Product out of stock';
}
?>
<?php
$items = Mage::getModel('sales/order_item')
->getCollection()
->addFieldToFilter('product_id', $_product->getId());
if ($_product->isAvailable()){
$ga_cnt = 0;
foreach ($items as $item) {
$ga_cnt += $item->getQtyOrdered() - $item->getQtyCanceled() - $item->getQtyRefunded();
}
if($ga_cnt > 0){
echo $ga_cnt.' people have purchased this product';
} else {
echo 'Be the first to buy this product!';
}
} else {
echo 'Product out of stock';
}
?>
Thanks for your great information, the contents are quiet interesting.I will be waiting for your next post.Web Designing Company in Bangalore | Web Development Company in Bangalore | Web Design Company in Bangalore
ReplyDelete