Index: branches/RC/core/units/general/cat_dbitem_export.php =================================================================== diff -u -N -r11685 -r11693 --- branches/RC/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 11685) +++ branches/RC/core/units/general/cat_dbitem_export.php (.../cat_dbitem_export.php) (revision 11693) @@ -496,7 +496,13 @@ $sql = 'SELECT ParentPath FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$this->Application->GetVar('m_cat_id'); - $this->exportOptions['BaseLevel'] = substr_count($this->Conn->GetOne($sql), '|') - 1; // level to cut from other categories + $parent_path = $this->Conn->GetOne($sql); + $parent_path = explode('|', substr($parent_path, 1, -1)); + if ($parent_path && $parent_path[0] == $this->Application->findModule('Name', 'Core', 'RootCat')) { + array_shift($parent_path); + } + + $this->exportOptions['BaseLevel'] = count($parent_path); // level to cut from other categories } // 1. export field titles if required @@ -1012,7 +1018,11 @@ FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; $category_path = $this->Conn->GetOne($sql); + $category_path = $category_path ? explode('&|&', $category_path) : Array(); + if ($category_path && strtolower($category_path[0]) == 'content') { + array_shift($category_path); + } if ($this->exportOptions['IsBaseCategory']) { $i = $this->exportOptions['BaseLevel']; @@ -1335,6 +1345,14 @@ $progress_t = $export_object->getModuleFolder($event).'/'.$event->Special.'_progress'; } $event->redirect = $progress_t; + + if ($event->Special == 'import') { + $import_category = (int)$this->Application->RecallVar('ImportCategory'); + + // in future could use module root category if import category will be unavailable :) + $event->SetRedirectParam('m_cat_id', $import_category); // for template permission checking + $this->Application->StoreVar('m_cat_id', $import_category); // for event permission checking + } } else {