Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r7391 -r7635 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 7391) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 7635) @@ -296,14 +296,19 @@ /** * Substitutes category in last template base on current category + * This is required becasue when you navigate catalog using AJAX, last_template is not updated + * but when you open item edit from catalog last_template is used to build opener_stack + * So, if we don't substitute m_cat_id in last_template, after saving item we'll get redirected + * to the first category we've opened, not the one we navigated to using AJAX * * @param Array $params */ function UpdateLastTemplate($params) { $category_id = $this->Application->GetVar('m_cat_id'); - list($index_file, $env) = explode('|', $this->Application->RecallVar('last_template'), 2); + $wid = $this->Application->GetVar('m_wid'); + list($index_file, $env) = explode('|', $this->Application->RecallVar(rtrim('last_template_'.$wid, '_')), 2); $this->Application->SetVar(ENV_VAR_NAME, str_replace('%5C', '\\', $env)); $this->Application->HttpQuery->processQueryString(); @@ -504,6 +509,19 @@ $params['skip_prefixes'] = implode(',', $skip_prefixes); return $this->Application->ParseBlock($params, 1); } + + function IsActive($params) + { + $cat_id = $this->Application->GetVar('c_id'); + $current_cat = $this->getObject($params); + $current_path = $current_cat->GetDBField('ParentPath'); + + static $parent_path = null; + if (!isset($parent_path)) { + $parent_path = $this->Conn->GetOne('SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$this->Application->GetVar('m_cat_id')); + } + return strpos($parent_path, $current_path) !== false; + } }