Get a list of bestsellers

Tweet, share & co

tweet fb share g+ share

Tags


Description

Get a list of bestsellers

Code

$collection = Mage::getResourceModel('sales/report_bestsellers_collection')
        ->setModel('catalog/product')
        ->addStoreFilter(Mage::app()->getStore()->getId()) //if you want the bestsellers for a specific store view. if you want global values remove this
    ->setPageSize(5)//set the number of products you want
    ->setCurPage(1);
foreach ($collection as $_product){
    $realProduct = Mage::getModel('catalog/product')->load($_product->getProductId());
    //do something with $realProduct;
}