0

for my shop project i am working with Magento 1.9 Mobile Version. Everything works fine as i wish but there is one Problem i cant fix.

The Menu (Navigation) in the Mobile Version doesn't show Sub-Menu Category's. Can i build them in, in an easy way? I thought i destroyed the code during my creation Process but its the same as on the demo store:

enterprise-demo.user.magentotrial.com/

Think i have to include something in the CSS file or in the menu.js?

Cant figure it out. Might be interesting for others to.

The helper get a German beer.

1 Answer 1

2

I think i found a solution, after looking for hours onto google i found it myself.

Thank you all for viewing. To Tell you its in the renderer.phtml file change it like this an it will work.

$html = '';

$children = $menuTree->getChildren(); $parentLevel = $menuTree->getLevel(); $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 1;

$counter = 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 = 'level'. $childLevel;
    $_hasChildren = ($child->hasChildren()) ? 'has-children' : '';

    $html .= '<li '. $this->_getRenderedMenuItemAttributes($child) .'>';

    $html .= '<a href="'. $child->getUrl() .'" class="'. $outermostClassCode .' '. $_hasChildren .'">'. $this->escapeHtml($this->__($child->getName())) .'</a>';

    if (!empty($childrenWrapClass)) {
        $html .= '<div class="'. $childrenWrapClass .'">';
    }

    $nextChildLevel = $childLevel + 1;

    if (!empty($_hasChildren)) {
        $html .= '<ul class="level'. $childLevel .'">';
        $html .=     '<li class="level'. $nextChildLevel .'">';
        $html .=         '<a class="level'. $nextChildLevel .'" href="'. $child->getUrl() .'">';
        /*$html .=             $this->__('View All ') . $this->escapeHtml($this->__($child->getName()));*/
        $html .=         '</a>';
        $html .=     '</li>';
        $html .=     $this->render($child, $childrenWrapClass);
        $html .= '</ul>';
    }

    if (!empty($childrenWrapClass)) {
        $html .= '</div>';
    }

    $html .= '</li>';

    $counter++; }

return $html;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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