本文介绍了magento中每种产品的总销售额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取magento中每种产品的总销售额?
How to get the total sales of each product in magento?
推荐答案
正如艾伦(Alan)指出的,有许多不同的方法可以限定产品的销售.
As Alan pointed out there's a number of different ways to qualify sales for a product.
但是要开始使用,一种简单的方法是使用报告模块.
But to get you started an easy way is to use the reporting module.
/** @var Mage_Report_Model_Mysql4_Product_Sold_Collection **/
$report = Mage::getResourceModel('report/product_sold_collection');
您可以根据需要设置日期范围或其他条件.收集完集合后,就可以对其进行迭代,如下所示:
You can set a date range or other criteria if you want. Once you have your collection just iterate over it, something like this:
foreach ($report AS $product) {
echo $product->getOrderedQty();
}
还有其他方法可以做到这一点,但这应该是一个起点.
There are other ways to do this too, but this should be a starting point.
这篇关于magento中每种产品的总销售额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!