Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5024 -r5036 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5024) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5036) @@ -306,6 +306,21 @@ $this->Application->SetVar('m_cat_id', $category_id); $this->Application->Session->SaveLastTemplate($params['template']); } + + function GetParentCategory($params) + { + $parent_id = 0; + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); + $table = $this->Application->getUnitOption($this->Prefix,'TableName'); + $cat_id = $this->Application->GetVar('m_cat_id'); + if ($cat_id > 0) { + $sql = 'SELECT ParentId + FROM '.$table.' + WHERE '.$id_field.' = '.$cat_id; + $parent_id = $this->Conn->GetOne($sql); + } + return $parent_id; + } }