Skip to content

Commit

Permalink
Merge pull request #1018 from plentymarkets/fix/pagination
Browse files Browse the repository at this point in the history
restore old values
  • Loading branch information
stentrop authored Aug 12, 2021
2 parents 2ce082d + 8931de1 commit 8f81005
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Services/CategoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,11 +589,17 @@ public function getNavigationList($type = CategoryType::ALL, string $lang = null
* @param int $catID The category id to get the parents for or 0 to use current category
* @param bool $bottomUp Set true to order result from bottom (deepest category) to top (= level 1)
* @param bool $filterCategories Filter categories
* @param bool $restoreOldValues Restore old category data and category tree after the method call.
* @return array The parents of the category
*/
public function getHierarchy(int $catID = 0, bool $bottomUp = false, bool $filterCategories = false): array
public function getHierarchy(int $catID = 0, bool $bottomUp = false, bool $filterCategories = false, $restoreOldValues = false): array
{
if ($catID > 0) {

if ($restoreOldValues) {
$oldCategory = $this->currentCategory;
$oldCategoryTree = $this->currentCategoryTree;
}
$this->setCurrentCategoryID($catID);
}

Expand All @@ -620,6 +626,11 @@ public function getHierarchy(int $catID = 0, bool $bottomUp = false, bool $filte
array_push($hierarchy, $this->currentItem['texts'][$lang]);
}

if ($restoreOldValues) {
$this->currentCategory = $oldCategory;
$this->currentCategoryTree = $oldCategoryTree;
}

return $hierarchy;
}

Expand Down Expand Up @@ -678,7 +689,7 @@ public function isHidden($categoryId)
return false;
}
$isHidden = false;
foreach ($this->getHierarchy($categoryId) as $category) {
foreach ($this->getHierarchy($categoryId, false, false, true) as $category) {
if ($category->right === 'customer') {
$isHidden = true;
break;
Expand Down

0 comments on commit 8f81005

Please sign in to comment.