-
Notifications
You must be signed in to change notification settings - Fork 9.4k
MAGETWO-61422 Respect Category Top Navigation Max Depth setting #12640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAGETWO-61422 Respect Category Top Navigation Max Depth setting #12640
Conversation
The setting `Stores > Configuration > Catalog > Catalog > Category Top Navigation > Maximal Depth` was actually never being used to limit the topmenu. Now the setting will be used as a condition for the category collection when it is fetched.
…x-depth-configuration Respect Category Top Navigation Max Depth setting
@lenlorijn can you sign the 'Contributor License Agreement'? |
I signed the Contributor License Agreement :) |
FYI: I will fix the Travis error regarding maximum line length after the holidays. Suppressing CouplingBetweenObjects in this case is ok because it would mean a major refactoring for the frequently used parent classes. |
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.
@arnoudhgz I hope you had a good start into the new year! I finally got around to check your PR and think there might be a change necessary to make this work as intended.
Please can you have a look at the code review?
Thanks!
ScopeInterface::SCOPE_STORE | ||
); | ||
if ($navigationMaxDepth > 0) { | ||
$this->addLevelFilter($navigationMaxDepth); |
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.
In my test, this looks like it doesn't work as intended. If I set a maximum depth of 1, no category is shown. If I set the value to 2, the top level category is displayed. If we add 1 to $navigationMaxDepth
like $this->addLevelFilter($navigationMaxDepth + 1)
, it works like I would expect it to. I guess that's because the root category level also has to be considered.
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.
No, that seems not like a good solution to me. I think we should adhere to the levels on http://docs.magento.com/m2/ee/user_guide/catalog/navigation-top.html
So in the admin configuration you have to use 2 for the first level.
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.
You are absolutely right. Thank you for pointing this out. The PR works as intended.
Thanks for your contribution @arnoudhgz! It has been merged into |
Description
The setting
Stores > Configuration > Catalog > Catalog > Category Top Navigation > Maximal Depth
was actually never being used to limit the top menu maximum depth.Now the setting will be used as a condition for the category collection when it is fetched.
Fixed Issues
Manual testing scenarios
Contribution checklist