3

In accordance with other posts/answers I've seen on this issue, I've overridden Magento_LayeredNavigation/templates/layer/view.html and edited the filter-options div with

<div class="filter-options" id="narrow-by-list" data-role="content" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": "0", "multipleCollapsible": false}}'>

This partly works -- changing the expand/collapse arrow to what it would look like if the category tab was expanded and setting aria-expanded to "true" -- but it doesn't actually expand. The content div has an inline style="display: none;"

If I try it with other tabs in the layered navigation, it works for them. Any reason why it wouldn't work for Category?

Edit: should note thank I'm inheriting blank, and not Luma.

  • You mean to show the div by default? – Sukumar Gorai Jul 26 '18 at 14:40
  • Yeah, to show the "Category" tab as expanded by default in the layered navigation. – brackfost Jul 26 '18 at 14:45
2

You can solve it by replacing below line:

<div class="filter-options" id="narrow-by-list" data-role="content" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": false, "multipleCollapsible": false}}'>

with:

<div class="filter-options" id="narrow-by-list" data-role="content" data-mage-init='{"accordion":{"openedState": "active", "collapsible": true, "active": "0", "multipleCollapsible": false}}'>

"active": "0" means first position filter which is category. If category position is second in your case then put 1 in place of 0.

  • This is actually what I tried. Edited to reflect that, but in my initial post I had "active": [0], from when I was trying the range approach -- had the same effect either way. When I was trying the range ("active" : [0, 1, 2]) the other tabs in that array would be open by default, but not category tab. – brackfost Jul 26 '18 at 15:48
  • What is the issue you are getting? This is working fine. Do you want multiple tabs open? – Sukumar Gorai Jul 26 '18 at 15:49
  • The category tab isn't expanded by default. I've tried to outline in my post that I've already tried the solutions offered in your answer and others, but that I'm still having issues with that particular tab. I only want category open. I was trying the array for troubleshooting's sake, and concluded that only the category tab is failing to expand by default. – brackfost Jul 26 '18 at 15:56
  • What is the position of your category tab? First? If yes then try to flush your cache once. – Sukumar Gorai Jul 26 '18 at 15:57
  • Also check if you are using any extension for category. – Sukumar Gorai Jul 26 '18 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.