Index: branches/5.2.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r15051 -r15108 --- branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15051) +++ branches/5.2.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 15108) @@ -1,6 +1,6 @@ Application->getUnitOption('ci', 'TableName'); + $module_prefixes = implode(',', $this->Conn->qstrArray($this->_getModulePrefixes())); + $sql = 'SELECT COUNT(*) FROM ' . $object->TableName . ' c - LEFT JOIN ' . $ci_table . ' ci ON c.CategoryId = ci.CategoryId - WHERE (c.TreeLeft BETWEEN ' . $object->GetDBField('TreeLeft') . ' AND ' . $object->GetDBField('TreeRight') . ') AND NOT (ci.CategoryId IS NULL)'; + JOIN ' . $ci_table . ' ci ON c.CategoryId = ci.CategoryId + WHERE (c.TreeLeft BETWEEN ' . $object->GetDBField('TreeLeft') . ' AND ' . $object->GetDBField('TreeRight') . ') AND (ci.ItemPrefix IN (' . $module_prefixes . '))'; + return $this->Conn->GetOne($sql); } + function _getModulePrefixes() + { + $ret = Array (); + + foreach ($this->Application->ModuleInfo as $module_info) { + $ret[] = $module_info['Var']; + } + + return array_unique($ret); + } + function ListCategories($params) { return $this->PrintList2($params);