Index: branches/5.3.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r16111 -r16395 --- branches/5.3.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 16111) +++ branches/5.3.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 16395) @@ -1,6 +1,6 @@ GetDBField('ParentPath'), 1, -1)); - $module_info = $category_helper->getCategoryModule($params, $category_path); + $module_info = $category_helper->getCategoryModule($params, $category_path); - // In-Edit & Proj-CMS module prefixes doesn't have custom field with item template - if ($module_info && $module_info['Var'] != 'adm' && $module_info['Var'] != 'st') { - + if ( $module_info ) { // 2. get item template by current category & module prefix $rewrite_processor = $this->Application->recallObject('kRewriteUrlProcessor'); /* @var $rewrite_processor kRewriteUrlProcessor */ @@ -921,6 +919,30 @@ } /** + * Builds link to a category in the Admin Tree. + * + * @param array $params Tag params. + * + * @return string + */ + protected function AdminTreeLink(array $params) + { + $params['direct_link'] = 1; + $params['pass'] = 'm'; + $params['m_opener'] = 'r'; + + if ( $this->Application->ConfigValue('Catalog_PreselectModuleTab') ) { + $module_prefix = $this->GetModulePrefix($params); + + if ( $module_prefix ) { + $params['anchor'] = 'tab-' . $module_prefix; + } + } + + return $this->CategoryLink($params); + } + + /** * Returns module prefix based on root category for given * * @param Array $params @@ -937,7 +959,8 @@ /* @var $category_helper CategoryHelper */ $module_info = $category_helper->getCategoryModule($params, $parent_path); - return $module_info['Var']; + + return $module_info ? $module_info['Var'] : 'c'; } function ImageSrc($params) @@ -2184,13 +2207,16 @@ function RelevanceIndicator($params) { + /** @var kDBItem $object */ $object = $this->getObject($params); - /* @var $object kDBItem */ - $search_results_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search'; + /** @var kSearchHelper $search_helper */ + $search_helper = $this->Application->recallObject('SearchHelper'); + + $search_results_table = $search_helper->getSearchTable(); $sql = 'SELECT Relevance - FROM '.$search_results_table.' - WHERE ResourceId = '.$object->GetDBField('ResourceId'); + FROM ' . $search_results_table . ' + WHERE ResourceId = ' . $object->GetDBField('ResourceId'); $percents_off = (int)(100 - (100 * $this->Conn->GetOne($sql))); $percents_off = ($percents_off < 0) ? 0 : $percents_off;