我有一個集合: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