Pages

Sunday, August 11, 2013

Get Top 10 Products in Magento

$collection= Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->setStoreId($storeId)
->addStoreFilter($storeId)

->setOrder(‘ordered_qty’, ’desc’)
->setPageSize(10) ;
foreach($collection as $product)
{
$name=$product->getName();
$productId=$product->getId();
$price=$product->getPrice();
}

No comments:

Post a Comment