Get categories products ordered by number of sales

Tweet, share & co

tweet fb share g+ share

Tags


Description

Get categories products ordered by number of sales

Code

$categoryId = 1; 
$category = Mage::getModel('catalog/category')->load($categoryId); 
$products = Mage::getResourceModel('reports/product_collection') 
          ->addOrderedQty() 
          ->addAttributeToSelect('*') 
          ->setOrder('ordered_qty', 'desc') 
          ->addCategoryFilter($category);