Skip to content

Commit 711b7f1

Browse files
authored
Merge pull request #114 from firegento/sprankhub-patch-1
Fix category update with category ID
2 parents ce4428b + b9db359 commit 711b7f1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Model/Import/Category.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,10 @@ protected function getParentCategory($rowData)
10951095
if ($rowData[self::COL_CATEGORY] == $this->getCategoryName($rowData)) {
10961096
// if _category eq. name then we don't have parents
10971097
$parent = false;
1098+
} elseif (is_numeric($rowData[self::COL_CATEGORY]) && isset($this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]])) {
1099+
// existing category given via ID, retrieve correct parent
1100+
$categoryParts = explode('/', $this->categoriesWithRoots[$rowData[self::COL_ROOT]][$rowData[self::COL_CATEGORY]][CategoryModel::KEY_PATH]);
1101+
$parent = $categoryParts[count($categoryParts) - 2];
10981102
} else {
10991103
$categoryParts = $this->explodeEscaped($this->_scopeConfig->getValue(Config::XML_PATH_CATEGORY_PATH_SEPERATOR), $rowData[self::COL_CATEGORY]);
11001104
array_pop($categoryParts);

0 commit comments

Comments
 (0)