File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ public function beforeGetHtml(
98
98
$ parentCategoryNode ->getTree (),
99
99
$ parentCategoryNode
100
100
);
101
+ $ categoryNode ->setData ('is_parent_active ' , $ category ->getParentId () == $ categoryParentId );
101
102
$ parentCategoryNode ->addChild ($ categoryNode );
102
103
103
104
$ mapping [$ category ->getId ()] = $ categoryNode ; //add node in stack
Original file line number Diff line number Diff line change @@ -220,7 +220,11 @@ protected function _getHtml(
220
220
$ parentPositionClass = $ menuTree ->getPositionClass ();
221
221
$ itemPositionClassPrefix = $ parentPositionClass ? $ parentPositionClass . '- ' : 'nav- ' ;
222
222
223
+ /** @var \Magento\Framework\Data\Tree\Node $child */
223
224
foreach ($ children as $ child ) {
225
+ if ($ childLevel === 0 && $ child ->getData ('is_parent_active ' ) === false ) {
226
+ continue ;
227
+ }
224
228
$ child ->setLevel ($ childLevel );
225
229
$ child ->setIsFirst ($ counter == 1 );
226
230
$ child ->setIsLast ($ counter == $ childrenCount );
You can’t perform that action at this time.
0 commit comments