我有一个集合:Magento的收藏的GroupBy的getSize
$this->_totalVersions = Mage::getModel('downloads/files')
->getCollection()
->addFieldToFilter('customer_groups', array('like' => '%'.$customergroupId.'%'))
->addFieldToFilter('main_table.is_active', 1)
->getSize()
完美的作品!但是当我添加一个group
它不起作用。
$this->_totalVersions = Mage::getModel('downloads/files')
->getCollection()
->addFieldToFilter('customer_groups', array('like' => '%'.$customergroupId.'%'))
->addFieldToFilter('main_table.is_active', 1)
->getSelect()->group(array('main_table.name'))
->getSize()
我不想使用->count()
或count($collection)
因为它拥有90.000+项目。
有没有一种合适的方法来计算集合?
由于提前,
的Martijn
太棒了!添加params'groupBy($ field,$ table = null)'使它变得完美 – cottton 2015-10-23 10:55:01