What is the php/magent开发者_开发技巧o code I can use to get the best selling products and display that name of the product.
For example, say I've sold 10 Foos, 20 Bars and 50 Bazes. I want to know how to query the Magento system and have it say "Bazes" are the high selling products (with 50).
Thanks you
Reports are a little weird, as they're implemented using collections that don't have a parent model. Try the following
$c = Mage::getResourceModel('sales/report_bestsellers_collection');
foreach($c as $item)
{
var_dump($item->getData());
}
Magento admin already has this.
- Go to the menu Reports > Products > Bestsellers.
- Make the "From" date sometime in the past, like January 1st.
- Make the "To" date today or sometime in the future.
- Change "Show by" to "Year" and click Refresh.
精彩评论