When I\'m using
$collection->getSelect()->group(\'entity_id\')
or
$collection->groupByAttribute(\'entity_id\')
<
in some cases, the method from Eric doesn't work.
It's better to rewrite the getSize()
method to
public function getSize()
{
if (is_null($this->_totalRecords)) {
$sql = $this->getSelectCountSql();
$result = $this->getConnection()->fetchAll($sql, $this->_bindParams);;
foreach ($result as $row) {
$this->_totalRecords += reset($row);
}
}
return intval($this->_totalRecords);
}