【发布时间】:2013-04-09 04:43:06
【问题描述】:
报告了几种情况,该查询的标准解决方案不起作用(关于 SO 的类似问题很多,但没有任何明确的解决方案)。
检索“畅销书”集合的方法是使用此查询构建器:
$storeId = Mage::app()->getStore()->getId();
$collection = Mage::getResourceModel('reports/product_collection');
$collection->setVisibility(Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds());
$collection = $collection
->addFieldToFilter('*')
->addOrderedQty()
->addStoreFilter()
->setStoreId($storeId)
->setOrder('ordered_qty', 'desc')
->setPageSize(10)
->setCurPage(1);
现在,$collection 结果包含一些虚假值,并且完全缺少重要属性(没有名称、价格等)。我什至无法在 1.7 中尝试 this core-code workaround。
任何人都可以发布一个经过 Magento 1.7 验证/认证/测试的解决方案吗? (或最新的 Magento 版本)。
【问题讨论】: