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(
$storeId = Mage::app()->getStore()->getId();
$_productCollection = Mage::getResourceModel('reports/product_collection')
                             ->addAttributeToFilter('visibility', $visibility)
                            ->setOrder('ordered_qty', 'desc');
           foreach($_productCollection as $bs_product){
           echo '<li><a href="'.$bs_product->getUrl_path().'">'.$bs_product->Name.'</a></li>';