/** * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $html = ''; $counter = 1; $children = $menuTree->getChildren(); $parentLevel = $menuTree->getLevel(); $childLevel = is_null($parentLevel) ? 0 : $parentLevel + 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); } $blockName = $childLevel == 0 ? 'bennoislost.easy-navigation.renderer.with-children' : 'bennoislost.easy-navigation.renderer.single'; $html .= $this->_renderBlockItem($blockName, $childrenWrapClass, $child, $outermostClassCode); $counter++; } return $html; }
/** * {@inheritDoc} */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } if ($child->hasChildren()) { $outermostClassCode .= ' data-toggle="dropdown" '; } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>'; $html .= $this->escapeHtml($child->getName()); if ($child->hasChildren()) { $html .= ' <b class="caret"></b>'; } $html .= '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . ' dropdown-menu">'; if (Mage::getStoreConfig('catalog/navigation/top_in_dropdown') && $childLevel == 0) { $prefix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_prefix'); $suffix = Mage::getStoreConfig('catalog/navigation/top_in_dropdown_suffix'); $html .= '<li class="level1 level-top-in-dropdown">'; $html .= '<a href="' . $child->getUrl() . '"><span>'; $html .= $this->escapeHtml($this->__($prefix) . ' ' . $child->getName() . ' ' . $suffix); $html .= '</span></a>'; $html .= '</li>'; $html .= '<li class="divider"></li>'; } $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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-'; $brandCategoryId = Mage::getStoreConfig('brand/brand/category_id'); $_helperBrands = Mage::helper('brand'); $brandUrl = Mage::getUrl($_helperBrands->getBrandsUrl()); 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); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $categoryId = str_replace("category-node-", "", $child->getId()); //$url=($categoryId==$brandCategoryId)?$brandUrl:$child->getUrl(); $url = $child->getUrl(); $html .= '<a href="' . $url . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; /*if($childLevel==0) { $html .= '<div class="submenu">'; }*/ $html .= $this->_getHtml($child, $childrenWrapClass); /*if($childLevel==0) { $html .= '</div>'; }*/ $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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) { $categoryId = str_replace('category-node-', '', $child->getId()); $category = Mage::getModel('catalog/category')->load($categoryId); if (!$category->getTopMenu()) { continue; } $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); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . ' class="nav-link">' . $this->escapeHtml($child->getName()) . '</a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } $html .= '<span class="subnav-toggle"><i class="icon icon-angle-down"></i><i class="icon icon-angle-up"></i></span>'; } $html .= '</li>'; $counter++; } return $html; }
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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) { $catId = explode("category-node-", $child->getId()); $categoryComplete = Mage::getModel('catalog/category')->load($catId[1]); $iconCode = Mage::getResourceModel('catalog/category')->getAttributeRawValue($catId[1], "meigee_cat_icon", Mage::app()->getStore()->getId()); if ($iconCode and $childLevel <= 1) { $icon = '<i class="fa fa-' . $iconCode . ' custom-icon"></i>'; } else { $icon = ''; } $catLabel = ''; if ($categoryComplete->getMeigeeCatCustomlabel()) { $catLabel = '<em class="category-label ' . $categoryComplete->getMeigeeCatCustomlabel() . '">' . $categoryComplete->getMeigeeCatLabeltext() . '</em>'; } if (Mage::getStoreConfig('meigee_categoriesenhanced/options/status') and $categoryComplete->getMeigeeCatMenutype() != 1) { $childrenWrapClass = 'menu-wrapper'; if ($categoryComplete->getMeigeeCatCustomlink()) { if ($categoryComplete->getMeigeeCatCustomlink() == '/') { $itemUrl = Mage::getBaseUrl(); } elseif ($categoryComplete->getMeigeeCatCustomlink() == '#') { $itemUrl = '#'; } else { $itemUrl = $categoryComplete->getMeigeeCatCustomlink(); } } else { $itemUrl = $child->getUrl(); } // Get ratio value $ratio = explode("/", $categoryComplete->getMeigeeCatRatio()); $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 == 1) { $html .= '<li class="level1">'; } else { $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; } $subTitle = ''; if ($childLevel == 1) { $subTitle = ' class="subtitle"'; } if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel > 0) { $html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>'; } if (!$categoryComplete->getMeigeeCatSubcontent()) { $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . ($categoryComplete->getMeigeeCatLinktarget() ? ' target="_blank"' : '') . '>' . $icon . '<span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span>' . $catLabel . '</a>'; } elseif ($categoryComplete->getMeigeeCatSubcontent() && $childLevel == 0) { $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . ($categoryComplete->getMeigeeCatLinktarget() ? ' target="_blank"' : '') . '>' . $icon . '<span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span>' . $catLabel . '</a>'; } if ($child->hasChildren()) { if (!empty($childrenWrapClass) && $childLevel == 0) { if ($categoryComplete->getMeigeeCatMaxQuantity() and is_numeric($categoryComplete->getMeigeeCatMaxQuantity())) { $columnsCount = $categoryComplete->getMeigeeCatMaxQuantity(); } else { $columnsCount = Mage::getStoreConfig('meigee_categoriesenhanced/options/column_count'); } $columnsCount = ' data-columns="' . $columnsCount . '"'; $categoryBg = ''; if ($categoryComplete->getMeigeeCatBg()) { $categoryBgOption = $categoryComplete->getMeigeeCatBgOption(); switch ($categoryBgOption) { case "1": $categoryBgOption = "background-position: left 0;"; break; case "2": $categoryBgOption = "background-position: right 0;"; break; case "3": $categoryBgOption = "background-position: center 0;"; break; case "4": $categoryBgOption = "background-size: 100% 100%;"; break; default: $categoryBgOption = "background-position: left 0;"; } $retinaBg = $categoryComplete->getMeigeeCatBgRetina(); if ($retinaBg) { $retinaBg = ' dataX2="background-image:url(' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/category/' . $categoryComplete->getMeigeeCatBgRetina() . '); ' . $categoryBgOption . '"'; } $categoryBg = ' style="background-image:url(' . Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . 'catalog/category/' . $categoryComplete->getMeigeeCatBg() . '); ' . $categoryBgOption . '"' . $retinaBg; } $html .= '<div class="' . $childrenWrapClass . '"' . $columnsCount . $categoryBg . '>'; } if ($categoryComplete->getMeigeeCatSubcontent()) { $html .= '<div class="sub-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatSubcontent()) . '</div>'; } else { if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel == 0) { $html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>'; } if ($categoryComplete->getMeigeeCatBlockRight() && $childLevel == 0) { $html .= '<div class="row"><div class="col-md-' . $ratio[0] . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass) && $childLevel == 0) { if ($categoryComplete->getMeigeeCatBlockRight()) { $html .= '</div>'; $html .= '<div class="col-md-' . $ratio[1] . ' right-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockRight()) . '</div></div>'; } $html .= '<div class="clear"></div>'; } if ($categoryComplete->getMeigeeCatBlockBottom() && $childLevel == 0) { $html .= '<div class="bottom-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockBottom()) . '</div><div class="clear"></div>'; } } if (!empty($childrenWrapClass) && $childLevel == 0) { $html .= '<div class="transparent"></div></div>'; } } if ($categoryComplete->getMeigeeCatBlockBottom() && $childLevel > 0) { $html .= '<div class="bottom-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockBottom()) . '</div><div class="clear"></div>'; } $html .= '</li>'; $counter++; } else { if ($categoryComplete->getMeigeeCatCustomlink()) { if ($categoryComplete->getMeigeeCatCustomlink() == '/') { $itemUrl = Mage::getBaseUrl(); } if ($categoryComplete->getMeigeeCatCustomlink() == '#') { $itemUrl = '#'; } else { $itemUrl = $categoryComplete->getMeigeeCatCustomlink(); } } else { $itemUrl = $child->getUrl(); } $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 (!Mage::getStoreConfig('meigee_categoriesenhanced/options/status')) { $catLabel = ''; } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '>' . $icon . '<span>' . $this->escapeHtml($child->getName()) . '</span>' . $catLabel . '</a>'; if ($child->hasChildren()) { if (empty($childrenWrapClass) and Mage::getStoreConfig('meigee_categoriesenhanced/options/status')) { $childrenWrapClass = 'menu-wrapper'; } if (!empty($childrenWrapClass)) { $isDefaultMenu = ''; if ($categoryComplete->getMeigeeCatMenutype() == 1) { $isDefaultMenu = ' default-menu'; } $html .= '<div class="' . $childrenWrapClass . $isDefaultMenu . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '<div class="transparent"></div></div>'; } } $html .= '</li>'; $counter++; } } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string * @deprecated since 1.8.2.0 use child block catalog.topnav.renderer instead */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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 . ' item-' : '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); } */ $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" title="' . $this->escapeHtml($child->getName()) . '">' . $this->escapeHtml($child->getName()) . '</a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="clearer">'; // E-Liquids if ($child->getId() == 'category-node-3') { if ($child->hasChildren()) { $html .= 'www' . $counter; } var_dump(count($child->getChildren())); die; if ($counter <= 3) { $html .= '<ul>'; $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" title="' . $this->escapeHtml($child->getName()) . '">' . $this->escapeHtml($child->getName()) . '</a>'; //$html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; } } elseif ($child->getId() == 4) { } else { $html .= $this->_getHtml($child, $childrenWrapClass); } $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } if ($childLevel == 1 && ($counter == 1 || $counter == 6 || $counter == 11)) { $html .= '<div class="menu-column">'; } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $url = $child->getName() == 'CATEGORIES' ? "javascript:;" : $child->getUrl(); $html .= '<a href="' . $url . '" ' . $outermostClassCode . '>' . $this->escapeHtml(ucfirst($child->getName())) . '</a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . ' sub-menu">'; //$html .='<div class="menu-column">'; $html .= $this->_getHtml($child, $childrenWrapClass); //$html .= '</div>'; $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; // $url = ""; // if($childLevel==0 && $counter==4): // $url ="/shop-by-brands.html"; // endif; if ($childLevel == 1 && $counter == $childrenCount && $child->getName() != "OUT OF STOCK") { $html .= '<li><a href="/shop-by-brands.html">More...</a></li> '; } if ($childLevel == 1 && ($counter == 5 || $counter == 10 || $counter == 16)) { $html .= '</div>'; } if ($counter == 15 && $child->getName() == 'BRANDS') { $html .= '<div class="menu-column menu-column-lg"> <h2>Featured Brands:</h2> <ul class="list-unstyled"> <li><a href="/shop-by-brands/bieossence.html"><img src="/media/catalog/category/bio-logo.jpg" alt="Bioessence"></a></li> <li><a href="/shop-by-brands/purebeauty.html"><img src="/media/catalog/category/pure-beauty-logo.jpg" alt="Pure beauty"></a></li> <li><a href="/shop-by-brands/la-roche.html"><img src="/media/catalog/category/brand-6_2.jpg" alt="LA ROCHE-POSAY"></a></li> </ul> </div>'; } $counter++; } return $html; }
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $html = ''; if (Mage::getStoreConfig('meigee_categoriesenhanced/options/status')) { $childrenWrapClass = 'menu-wrapper'; $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) { $catId = explode("category-node-", $child->getId()); $categoryComplete = Mage::getModel('catalog/category')->load($catId[1]); if ($categoryComplete->getMeigeeCatCustomlink()) { if ($categoryComplete->getMeigeeCatCustomlink() == '/') { $itemUrl = Mage::getBaseUrl(); } elseif ($categoryComplete->getMeigeeCatCustomlink() == '#') { $itemUrl = '#'; } else { $itemUrl = $categoryComplete->getMeigeeCatCustomlink(); } } else { $itemUrl = $child->getUrl(); } // Get ratio value $ratio = explode("/", $categoryComplete->getMeigeeCatRatio()); $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 == 1) { $html .= '<li class="level1 grid_2 alpha">'; } else { $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; } $subTitle = ''; if ($childLevel == 1) { $subTitle = ' class="subtitle"'; } if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel > 0) { $html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>'; } if (!$categoryComplete->getMeigeeCatSubcontent()) { $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '><span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span></a>'; } elseif ($categoryComplete->getMeigeeCatSubcontent() && $childLevel == 0) { $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '><span' . $subTitle . '>' . $this->escapeHtml($child->getName()) . '</span></a>'; } if ($child->hasChildren()) { if (!empty($childrenWrapClass) && $childLevel == 0) { $html .= '<div class="' . $childrenWrapClass . '">'; } if ($categoryComplete->getMeigeeCatSubcontent()) { $html .= '<div class="sub-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatSubcontent()) . '</div>'; } else { if ($categoryComplete->getMeigeeCatBlockTop() && $childLevel == 0) { $html .= '<div class="top-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockTop()) . '</div><div class="clear"></div>'; } if ($categoryComplete->getMeigeeCatBlockRight()) { $html .= '<div class="grid_' . $ratio[0] . ' alpha omega">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass) && $childLevel == 0) { if ($categoryComplete->getMeigeeCatBlockRight()) { $html .= '</div>'; $html .= '<div class="grid_' . $ratio[1] . ' alpha omega right-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockRight()) . '</div>'; } $html .= '<div class="clear"></div>'; } if ($categoryComplete->getMeigeeCatBlockBottom()) { $html .= '<div class="bottom-content">' . $this->helper('cms')->getBlockTemplateProcessor()->filter($categoryComplete->getMeigeeCatBlockBottom()) . '</div><div class="clear"></div>'; } } if (!empty($childrenWrapClass) && $childLevel == 0) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } } else { $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) { $catId = explode("category-node-", $child->getId()); $categoryComplete = Mage::getModel('catalog/category')->load($catId[1]); if ($categoryComplete->getMeigeeCatCustomlink()) { if ($categoryComplete->getMeigeeCatCustomlink() == '/') { $itemUrl = Mage::getBaseUrl(); } if ($categoryComplete->getMeigeeCatCustomlink() == '#') { $itemUrl = '#'; } else { $itemUrl = $categoryComplete->getMeigeeCatCustomlink(); } } else { $itemUrl = $child->getUrl(); } $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); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $itemUrl . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { if (Mage::getStoreConfig('mpanel/general/enabled')) { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a id="link-mobile-menu-' . $child->getId() . '" href="' . $child->getUrl() . '"'; if ($child->hasChildren()) { $html .= ' class="dropdown-toggle"'; } $html .= '>' . $this->escapeHtml($child->getName()); if ($child->hasChildren()) { $html .= ' <i class="fa fa-plus" onclick="mgsjQuery(\'#mobile-menu-' . $child->getId() . '\').slideToggle(); mgsjQuery(\'#link-mobile-menu-' . $child->getId() . '\').toggleClass(\'collapse\'); mgsjQuery(\'#mobile-menu-' . $child->getId() . '\').toggleClass(\'active\'); return false"></i>'; } $html .= '</a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="dropdown-menu" id="mobile-menu-' . $child->getId() . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; } else { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; } }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } // GravDept, open .menu wrapper if ($childLevel == 0) { $html .= '<div class="menu">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; // GravDept, add "View All" link for sub-category if ($childLevel == 1) { $html .= '<a class="view-all" href="' . $child->getUrl() . '">' . $this->__('View All') . '</a>'; } // GravDept, close .menu wrapper if ($childLevel == 0) { $html .= '</div>'; } if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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) { $childClass = ''; $child->setLevel($childLevel); $child->setIsFirst($counter == 1); $child->setIsLast($counter == $childrenCount); $child->setPositionClass($itemPositionClassPrefix . $counter); $outermostClassCode = ''; $outermostClass = $menuTree->getOutermostClass(); $megamenuData = array('type' => '', 'layout' => 'menu', 'menu' => 1, 'top' => '', 'bottom' => '', 'right' => '', 'percent' => 0); if ($childLevel == 0) { if ($outermostClass) { $childClass .= ' ' . $outermostClass; } $category = Mage::getModel('catalog/category')->load(str_replace('category-node-', '', $child->getId())); $childClass .= ' ' . $category->getOlegnaxmegamenuType(); $megamenuData['type'] = $category->getOlegnaxmegamenuType(); $megamenuData['layout'] = $category->getOlegnaxmegamenuLayout(); $megamenuData['menu'] = $category->getOlegnaxmegamenuMenu(); $megamenuData['top'] = $category->getOlegnaxmegamenuTop(); $megamenuData['bottom'] = $category->getOlegnaxmegamenuBottom(); $megamenuData['right'] = $category->getOlegnaxmegamenuRight(); $megamenuData['percent'] = $category->getOlegnaxmegamenuRightPercent(); if ($megamenuData['menu'] == '') { $megamenuData['menu'] = 1; } if ($megamenuData['percent'] == '') { $megamenuData['percent'] = 0; } if (empty($megamenuData['layout'])) { $megamenuData['layout'] = 'menu'; } } $showChildren = false; $leftClass = $rightClass = $top = $bottom = $right = $menu = ''; if ($child->hasChildren() || $childLevel == 0 && $megamenuData['type'] == 'wide' && (!empty($megamenuData['top']) || !empty($megamenuData['bottom']) || !empty($megamenuData['right']) && $megamenuData['percent'] != 0)) { $showChildren = true; if ($megamenuData['type'] == 'wide') { $leftClass = 'megamenu-block-col-' . (6 - $megamenuData['percent']); $rightClass = 'megamenu-block-col-' . $megamenuData['percent']; $top = $this->_drawMenuBlock('top', $megamenuData['top']); $bottom = $this->_drawMenuBlock('bottom', $megamenuData['bottom']); $right = $this->_drawMenuBlock('right', $megamenuData['right']); } if ($megamenuData['menu'] == 1 || $megamenuData['type'] != 'wide') { $menu .= '<ul class="level' . $childLevel . '">'; $menu .= $this->_getHtml($child, $childrenWrapClass); $menu .= '</ul>'; $menu .= '<div class="clear"></div>'; } if (!$child->hasChildren() || $megamenuData['menu'] != 1) { $childClass .= ' parent parent-fake'; } } $child->setClass($childClass); $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($showChildren) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } if ($childLevel == 0 && $megamenuData['type'] == 'wide') { switch ($megamenuData['layout']) { case 'top_menu': $html .= '<div class="megamenu-block-col ' . $leftClass . '">'; $html .= $top; $html .= $menu; $html .= '</div>'; $html .= '<div class="megamenu-block-col ' . $rightClass . '">'; $html .= $right; $html .= '</div>'; $html .= '<div class="clear"></div>'; $html .= $bottom; break; case 'top_menu_bottom': $html .= '<div class="megamenu-block-col ' . $leftClass . '">'; $html .= $top; $html .= $menu; $html .= $bottom; $html .= '</div>'; $html .= '<div class="megamenu-block-col ' . $rightClass . '">'; $html .= $right; $html .= '</div>'; $html .= '<div class="clear"></div>'; break; case 'menu': default: $html .= $top; $html .= '<div class="megamenu-block-col ' . $leftClass . '">'; $html .= $menu; $html .= '</div>'; $html .= '<div class="megamenu-block-col ' . $rightClass . '">'; $html .= $right; $html .= '</div>'; $html .= '<div class="clear"></div>'; $html .= $bottom; } } else { $html .= $menu; } if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
/** * Recursively generates top menu html from data that is specified in $menuTree * * @param Varien_Data_Tree_Node $menuTree * @param string $childrenWrapClass * @return string * @deprecated since 1.8.2.0 use child block catalog.topnav.renderer instead */ protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { $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); if (strlen($child->getData('thumbnail')) > 1) { $url = Mage::getBaseUrl('media') . 'catalog/category/' . $child->getData('thumbnail'); } else { $url = "http://dev.aduroproducts.com/skin/frontend/Aduro/default/images/opc-ajax-loader.gif"; } $outermostClassCode = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . '" '; $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . ' style="background-image:url(' . $url . '); background-position:bottom right; background-repeat:no-repeat;">'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } $html .= '<ul class="level' . $childLevel . '">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }
protected function _getHtml(Varien_Data_Tree_Node $menuTree, $childrenWrapClass) { Mage::log('hi1', null, 'nil.log'); $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 = ''; $outermostClass = $menuTree->getOutermostClass(); if ($childLevel == 0 && $outermostClass) { $outermostClassCode = ' class="' . $outermostClass . ($child->hasChildren() ? ' dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" ' : '"'); $child->setClass($outermostClass); } $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>'; $html .= '<a href="' . $child->getUrl() . '" ' . $outermostClassCode . $dataDropdown . '><span>' . $this->escapeHtml($child->getName()) . '</span></a>'; if ($child->hasChildren()) { if (!empty($childrenWrapClass)) { $html .= '<div class="' . $childrenWrapClass . '">'; } if ($childLevel < 1) { $html .= '<ul class="level' . $childLevel . ' dropdown-menu">'; $html .= $this->_getHtml($child, $childrenWrapClass); $html .= '</ul>'; } if (!empty($childrenWrapClass)) { $html .= '</div>'; } } $html .= '</li>'; $counter++; } return $html; }