Skip to content

Commit

Permalink
Don't add prefix for root category 1 (#142)
Browse files Browse the repository at this point in the history
* Don't add prefix for root category 1

* Change if

* Returning id 1 causes issues in ALP's. Return empty string

* Default category setting is wrong

* Fix typo

* Update Config.php
  • Loading branch information
ah-net committed Jan 23, 2024
1 parent fa2136f commit 764141d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Model/Client/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ public function addCategoryPathFilter(array $categoryIds)
$categoryIds = array_map('intval', $categoryIds);
$storeId = (int) $this->getStoreId();
$tweakwiseIdMapper = function (int $categoryId) use ($storeId) {
//don't add prefix for root category 1.
if ($categoryId === 1) {
return '';
}

return $this->helper->getTweakwiseId($storeId, $categoryId);
};
$tweakwiseIds = array_map($tweakwiseIdMapper, $categoryIds);
Expand Down
2 changes: 1 addition & 1 deletion Model/Config/Source/CategoryView.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class CategoryView implements OptionSourceInterface
protected function buildOptions()
{
return [
['value' => self::EXTENDED, 'label' => __('Extended')],
['value' => self::SIMPLE, 'label' => __('Simple (deprecated)')],
['value' => self::EXTENDED, 'label' => __('Extended')],
];
}

Expand Down

0 comments on commit 764141d

Please sign in to comment.