diff --git a/Model/Import/Category.php b/Model/Import/Category.php index e27c693..113d827 100644 --- a/Model/Import/Category.php +++ b/Model/Import/Category.php @@ -1095,6 +1095,10 @@ protected function getParentCategory($rowData) if ($rowData[self::COL_CATEGORY] == $this->getCategoryName($rowData)) { // if _category eq. name then we don't have parents $parent = false; + } elseif (is_numeric($rowData[self::COL_CATEGORY]) && isset($this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]])) { + // existing category given via ID, retrieve correct parent + $categoryParts = explode('/', $this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]][CategoryModel::KEY_PATH]); + $parent = $categoryParts[count($categoryParts) - 2]; } else { $categoryParts = $this->explodeEscaped($this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR), $rowData[self::COL_CATEGORY]); array_pop($categoryParts);