This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Fix regexp when filter by root category id #121
Merged
magento-engcom-team
merged 10 commits into
magento:2.3-develop
from
mhhansen:fix-categorytree-root-regexp
Oct 4, 2018
Merged
Fix regexp when filter by root category id #121
magento-engcom-team
merged 10 commits into
magento:2.3-develop
from
mhhansen:fix-categorytree-root-regexp
Oct 4, 2018
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
naydav
reviewed
Jul 19, 2018
@@ -94,8 +94,17 @@ public function getTree(ResolveInfo $resolveInfo, int $rootCategoryId) : array | |||
$this->joinAttributesRecursively($collection, $categoryQuery); | |||
$depth = $this->depthCalculator->calculate($categoryQuery); | |||
$level = $this->levelCalculator->calculate($rootCategoryId); | |||
|
|||
// If root category is being filter, we've to remove first slash | |||
if ($rootCategoryId == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we need to use \Magento\Catalog\Model\Category::TREE_ROOT_ID
instead of 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's exactly what I didn't found when I did that fix..
awesome! I will be pushing the update
@naydav welcome back! |
-- fix coupling between object in CategoryTree
-- fix static tests
-- fix static tests
-- fix static tests
…ee-root-regexp # Conflicts: # app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/CategoryTree.php
-- fixes after mainline merge
magento-engcom-team
pushed a commit
that referenced
this pull request
Oct 4, 2018
This was referenced Oct 4, 2018
magento-engcom-team
pushed a commit
that referenced
this pull request
May 31, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
At present, if you query the category tree requesting the Root Category (
id = 1
), query returns empty.This is caused by the regular expression that filters the
catalog_category_entity
.path
column table, which includes for all cases, a slash (/
) at the beginning.In the case of the Root Category, there's no slash at the beginning.
This has been tested for this scenarios:
Root Category
created post install.For all cases, in the
catalog_category_entity
.path
column table, categories are always created as a1/
children.Fixed Issues (if relevant)
Fixed issue: No issue created to this PR.
Issue related: Category tree depth calculation issue #100
Manual testing scenarios
To be able to test this PR, you have to first apply the PR #102, which fixes the category deph
children
param.category(id: 1)
, to get the entire CategoryRoot Category
with all the children.Query the Root Category
Expected result
Actual result
Contribution checklist