Index: branches/RC/core/units/general/helpers/count_helper.php =================================================================== diff -u -r9001 -r9002 --- branches/RC/core/units/general/helpers/count_helper.php (.../count_helper.php) (revision 9001) +++ branches/RC/core/units/general/helpers/count_helper.php (.../count_helper.php) (revision 9002) @@ -156,11 +156,15 @@ * @param bool $today * @return int */ - function ItemCount($prefix, $today = false) + function ItemCount($prefix, $today = false, $count_sql = null) { $table_name = $this->Application->getUnitOption($prefix, 'TableName'); - $sql = 'SELECT COUNT(*) + if (!isset($count_sql)) { + $count_sql = 'COUNT(*)'; + } + + $sql = 'SELECT '.$count_sql.' FROM '.$table_name.' item_table INNER JOIN '.TABLE_PREFIX.'CategoryItems ci ON ci.ItemResourceId = item_table.ResourceId INNER JOIN '.TABLE_PREFIX.'Category c ON c.CategoryId = ci.CategoryId @@ -178,7 +182,7 @@ $sql .= ' WHERE ('.implode(') AND (', $where_clauses).')'; - return $this->Conn->GetOne($sql); + return (int)$this->Conn->GetOne($sql); } /**