MAGETWO-61422 Respect Category Top Navigation Max Depth setting#12640
MAGETWO-61422 Respect Category Top Navigation Max Depth setting#12640magento-team merged 4 commits intomagento:2.3-developfrom mediact:bugfix/MAGETWO-61422-category-max-depth-configuration
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. |
mzeis
left a comment
There was a problem hiding this comment.
@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.
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.
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.
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 |
|
Thanks for your contribution @arnoudhgz! It has been merged into |
Description
The setting
Stores > Configuration > Catalog > Catalog > Category Top Navigation > Maximal Depthwas 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