Show Top Selling Products in Magento
This a simple best seller product viewing code. you can put it in template. this will grab all the sold product according to sold amount, you can simply put a loop break to show number of products you want to show .
<?php /* Best Seller*/
$visibility = array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
);
$storeId = Mage::app()->getStore()->getId();
$_productCollection = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->addOrderedQty()
->addAttributeToFilter('visibility', $visibility)
->setOrder('ordered_qty', 'desc');
//print_r($_productCollection);
foreach($_productCollection as $bs_product){
echo '<li><a href="'.$bs_product->getUrl_path().'">'.$bs_product->Name.'</a></li>';
}
?>