Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 . '">';
- }
- $html .= '<ul class="level' . $childLevel . '">';
- $html .= $this->_getHtml($child, $childrenWrapClass);
- $html .= '</ul>';
- if (!empty($childrenWrapClass)) {
- $html .= '</div>';
- }
- }
- $html .= '</li>';
- $counter++;
- }
- return $html;
- }
- $splittedArray = explode($delimiter = 'category-node-', $child->getId());
- $category = Mage::getModel('catalog/category')->load(end($splittedArray));
- $html .= '<li ' . $this->_getRenderedMenuItemAttributes($child) . '>';
- if (!empty($category->getData('image'))) {
- $html .= '<div> ';
- $html .= "<a href=" . $category->getURL() . " title =" . $category->getName() . ">";
- $html .= "<img src=" . Mage::getBaseUrl('media') . 'catalog/category/' . $category->getData('image') . " alt=" . $category->getName() . " >";
- $html .= "</a>";
- $html .= '</div>';
- }
Add Comment
Please, Sign In to add comment