Magento SOAP API: Getting Top Selling Products
I just learned Magento and its web services API for a new job. I've just managed to create some basic PHP scripts getting products in specific categories. Now I need to get the best selling products, but I am trying to find good documentation on this. Any help, pointers, example code or anything else is really greatly appreciated ...
Thank,
Tom
+2
source to share
2 answers
I believe there is no way to do this using the Web Services API. However, inside Magento native PHP, you can get top-selling products with the following parameters:
$bestselling_products = Mage::getResourceModel('reports/product_collection')
->addAttributeToSelect('*')
->setStoreId(1)
->addOrderedQty($from, $today)
->addAttributeToFilter('visibility', $visibility)
->addAttributeToFilter('status', 1)
->setOrder('ordered_qty', desc);
+1
source to share