Application->getUnitOption('c', 'IDField'); $table_name = $this->Application->getUnitOption('c', 'TableName'); $sql = 'SELECT '.$id_field.' FROM '.$table_name.' WHERE ParentId = '.$category_id; $sub_categories = $this->Conn->GetCol($sql); if ($sub_categories) { foreach ($sub_categories as $sub_category_id) { $this->DeleteCategory($sub_category_id); } } // 1. remove category items from this category if it is supplemental (non-primary) category to them $sql = 'DELETE FROM '.TABLE_PREFIX.'CategoryItems WHERE ('.$id_field.' = '.$category_id.') AND (PrimaryCat = 0)'; $this->Conn->Query($sql); $temp_handler =& $this->Application->recallObject('c_TempHandler', 'kTempTablesHandler'); // 2. delete items this have this category as primary // $temp_handler->DeleteItems($item_prefix, '', $item_ids); // 3. delete this category $temp_handler->DeleteItems('c', '', Array($category_id)); } } ?>