I’m just learning Magento and its Web Services API for a new job. I’ve just managed to build some basic PHP scripts fetching products in specific categories. I now need to fetch the best-selling products, but am struggling to find good documentation on this. Any help, pointers, sample code or anything else really would be much appreciated...
Thanks,
Tom
I believe there's no way to do this with the Web Services API. However within Magento's own PHP you can get the most sold products with the following:
$bestselling_products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->setStoreId(1)
->addOrderedQty($from, $today)
->addAttributeToFilter('visibility', $visibility)
->addAttributeToFilter('status', 1)
->setOrder('ordered_qty', desc);