1
说我有所谓的库存下列实体:Magento的集合:场次数计数
我想知道是否有数据库,SQL或Magento的行为或任何其他方法来产生:
我已经通过整个集合遍历并插入到一个临时表解决了这个:即
$inventorySet = Mage::getModel('custom/module')->getCollection(*);
foreach($inventorySet as $item)
{
$this->insertItem($item->getSku());
}
}
public function insertItem($sku)
{
//insert sku if it does not exist in the temp set
// if it does exists add one to the QTY field
}
然后我就可以找回我想要什么。我没有看到它的问题,但我的实体比示例以及包含2000-15000行之间的任何内容的数据集大得多。有没有更有效的方法来做到这一点?
欢呼声。
编辑:在单词中,我想搜索“sku”字段出现的集合,并返回一个不明确的sku数组以及它在初始集合中发现的次数。
thnks
辉煌!非常感谢,正是我想要的。从来没有这样做过。干杯! – activeDev