Index: branches/unlabeled/unlabeled-1.13.2/core/units/configuration/configuration_tag_processor.php =================================================================== diff -u -N -r5215 -r5636 --- branches/unlabeled/unlabeled-1.13.2/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 5215) +++ branches/unlabeled/unlabeled-1.13.2/core/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 5636) @@ -148,37 +148,48 @@ */ function CategoryPath($params) { + $block_params['separator'] = $params['separator']; + if (!isset($params['cat_id'])) { $params['cat_id'] = $this->ModuleRootCategory( Array() ); } - - $block_params['current'] = 1; - $block_params['separator'] = $params['separator']; + if ($params['cat_id'] == 0) { - $block_params['name'] = $params['rootcatblock']; + $block_params['cat_id'] = 0; + $block_params['cat_name'] = $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params); + $block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as'); return $this->Application->ParseBlock($block_params); } else { - $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List'); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $sql = 'SELECT CategoryId, ParentId, '.$ml_formatter->LangFieldName('Name').' AS Name - FROM '.TABLE_PREFIX.'Category - WHERE CategoryId = '.$params['cat_id']; - $res = $this->Conn->GetRow($sql); - if ($res === false) { - // in case if category is deleted - return ''; + $navbar_field = $ml_formatter->LangFieldName('CachedNavBar'); + + $id_field = $this->Application->getUnitOption('c', 'IDField'); + $table_name = $this->Application->getUnitOption('c', 'TableName'); + $sql = 'SELECT '.$navbar_field.', ParentPath + FROM '.$table_name.' + WHERE '.$id_field.' = '.$params['cat_id']; + $category_data = $this->Conn->GetRow($sql); + $ret = ''; + if ($category_data) { + $category_names = explode('|', $category_data[$navbar_field]); + $category_ids = explode('|', substr($category_data['ParentPath'], 1, -1)); + + // add "Home" category at beginning of path + array_unshift($category_names, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params)); + array_unshift($category_ids, 0); + + foreach ($category_ids as $category_pos => $category_id) { + $block_params['cat_id'] = $category_id; + $block_params['cat_name'] = $category_names[$category_pos]; + $block_params['name'] = $this->SelectParam($params, 'render_as,block'); + + $this->Application->SetVar($this->Prefix.'_id', $category_id); + $ret .= $this->Application->ParseBlock($block_params, 1); + } } - $block_params['name'] = $params['block']; - $block_params['cat_name'] = $res['Name']; - $block_params['separator'] = $params['separator']; - $block_params['cat_id'] = $res['CategoryId']; - $next_params['separator'] = $params['separator']; - $next_params['rootcatblock'] = $params['rootcatblock']; - $next_params['block'] = $params['block']; - $next_params['cat_id'] = $res['ParentId']; - return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); + + return $ret; } }