I've downloaded the free ibnab megamenu extension and all is working fine apart from one bug
Megamenu only displays under first 5 parent categories for all the following categories no html is generated in desktop view (mobile works), so i get a megamenu dropdown only from first 5 categories
I believe the problem lies somewhere in these functions but it all looks foreign to me as i've never meddled with inyards of magento
protected function _getHtml( \Magento\Framework\Data\Tree\Node $menuTree, $childrenWrapClass, $limit, $colBrakes = [] ) { $html = ''; $children = $menuTree->getChildren(); $parentLevel = $menuTree->getLevel(); $childLevel = $parentLevel === null ? 0 : $parentLevel + 1; $counter = 1; $itemPosition = 1; $childrenCount = $children->count(); $parentPositionClass = $menuTree->getPositionClass(); $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-'; foreach ($children as $child) { $child->setLevel($childLevel); $child->setIsFirst($counter == 1); $child->setIsLast($counter == $childrenCount); $child->setPositionClass($itemPositionClassPrefix . $counter); $outermostClassCode = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } if(is_array($colBrakes) || is_object($colBrakes)){ if (count($colBrakes) && $colBrakes[$counter]['colbrake']) { $html .= '</ul></li><li class="column"><ul>'; } } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; if ($child->getCategoryIsLink()) { $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '>'; }else{ $html .= '<a ' . $outermostClassCode . '>'; } $html .= '<span>' . $this->escapeHtml( $child->getName() ) . '</span>'; $html .= '</a>'; $html .= $this->_addSubMenu( $child, $childLevel, $childrenWrapClass, $limit ) . '</li>';; $itemPosition++; $counter++; } if(is_array($colBrakes) || is_object($colBrakes)){ if (count($colBrakes) && $limit) { $html = '<li class="column"><ul>' . $html . '</ul></li>'; } } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param \Magento\Framework\Data\Tree\Node $menuTree * @param string $childrenWrapClass * @param int $limit * @param array $colBrakes * @return string * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ protected function _getHtml2( \Magento\Framework\Data\Tree\Node $menuTree, $childrenWrapClass, $limit, $colBrakes = [] ) { if ($this->dataHelper->allowExtension()) { $html = ''; $children = $menuTree->getChildren(); $parentLevel = $menuTree->getLevel(); $childLevel = $parentLevel === null ? 0 : $parentLevel + 1; $counter = 1; $itemPosition = 1; $childrenCount = $children->count(); $parentPositionClass = $menuTree->getPositionClass(); $itemPositionClassPrefix = $parentPositionClass ? $parentPositionClass . '-' : 'nav-'; foreach ($children as $child) { $child->setLevel($childLevel); $child->setIsFirst($counter == 1); $child->setIsLast($counter == $childrenCount); $child->setPositionClass($itemPositionClassPrefix . $counter); $outermostClassCode = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } if ($childLevel == 0) { $arrayId = explode('-', $child->_getData('id')); $category = null; if (isset($arrayId[2])) { $id = $arrayId[2]; $category = $this->categoryFactory->create(); $category->load($id); $this->coreRegistry->unregister('current_categry_top_level'); $this->coreRegistry->register('current_categry_top_level', $category); } } if(is_array($colBrakes) || is_object($colBrakes)){ if (count($colBrakes) && $colBrakes[$counter]['colbrake']) { $html .= '</ul></li><li><ul>'; } } $html .= '<li>'; if ($childLevel == 0) { $name = $child->getName(); $category = $this->coreRegistry->registry('current_categry_top_level'); if ($category != null) { if ($category->getUseLabel()) { if ($category->getLabelValue() != "") { $name = $category->getLabelValue(); } else { $name = $child->getName(); } } else { $name = $child->getName(); } } if ($category->getCategoryIsLink()) { $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '>'; }else{ $html .= '<a ' . $outermostClassCode . '>'; } $html .= '<span>' . $this->escapeHtml( $name ) . '</span>'; $html .= '</a>'; $html .= $this->_addSubMenu2($child, $childLevel, $childrenWrapClass, $limit ) . '</li>'; } else { $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml( $child->getName() ) . '</span></a>' . $this->_addSubMenu2( $child, $childLevel, $childrenWrapClass, $limit ) . '</li>'; } $itemPosition++; $counter++; } if(is_array($colBrakes) || is_object($colBrakes)){ if (count($colBrakes) && $limit) { $html = '<li class="column"><ul>' . $html . '</ul></li>'; } } return $html; } else { return parent::_getHtml( $menuTree, $childrenWrapClass, $limit, $colBrakes ); } }
any ideas??