Skip to content

Commit

Permalink
Merge pull request #114 from firegento/sprankhub-patch-1
Browse files Browse the repository at this point in the history
Fix category update with category ID
  • Loading branch information
avstudnitz authored Apr 8, 2021
2 parents ce4428b + b9db359 commit 711b7f1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Model/Import/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 711b7f1

Please sign in to comment.