magento2: Invisible breadcrumbs at product page when mageMenu widget is not used
Preconditions
- Magento 2.2.4 only
Steps to reproduce
- Open
app/code/Magento/Theme/view/frontend/templates/html/topmenu.phtml - Remove the following code from the template:
data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'
- Navigate to the product page
Expected result
- Breadcrumbs should remain visible
Actual result
- Breadcrumbs are not rendered
Explanation
2.2.4 release uses js component to render breadcrumbs on the product page. Here is its init method:
I don’t really know what is this check for if (typeof menu === 'undefined') {, and why do we even need to get mageMenu, maybe @ameysar can help with explanation?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 6
- Comments: 15 (7 by maintainers)
on one of our sites we use a custom menu - even with the fix it seems we are forced to use some sort of compatible menu, just for the breadcrumbs - that has to be crazy doesn’t it - surely there should be a fall back option? Perhaps some sort of config setting?
I can confirm this bug on 2.2.5.
EDIT: you have to debug
vendor/magento/module-catalog/view/frontend/web/js/product/breadcrumbs.js. The function_resolveCategoryMenuItem()probably returns null, that’s why it doesn’t work. In my case, I had to adddata-action="navigation"to my<nav>section. Also, I had to add the classcategory-itemon my<li>items because of thecategoryItemSelectoroption.Same issue here (magento 2.2.4)