getIsActive()) { return ''; } $html = array(); $max_level=Mage::getStoreConfig('megamenu/general/depth'); // get all children if (Mage::helper('catalog/category_flat')->isEnabled()) { $children = (array)$category->getChildrenNodes(); $childrenCount = count($children); } else { $children = $category->getChildren(); $childrenCount = $children->count(); } $hasChildren = ($children && $childrenCount); // select active children $activeChildren = array(); foreach ($children as $child) { if($level >= $max_level-1){break;} if ($child->getIsActive()) { $activeChildren[] = $child; } } $activeChildrenCount = count($activeChildren); $hasActiveChildren = ($activeChildrenCount > 0); $catdetail = Mage::getModel('catalog/category')->load($category->getId()); $menutypes = $catdetail->getData('arwmenu_cat_groups'); // Check if show category block if no sub-category $showblock = false; $showblock = $hasActiveChildren; if (Mage::helper('megamenu')->getCfg('menu/show_if_no_children')) {$showblock = true; } // prepare list item html classes $classes = array(); $classes[] = $catdetail->getData('custom_classes'); $classes[] = 'level' . $level; if(!$hasActiveChildren) { $classes[]='no-child'; } if($level==1){ $classes[] = 'groups item'; } $classes[] = 'nav-' . $this->_getItemPosition($level); if ($this->isCategoryActive($category)) { $classes[] = 'active'; } $linkClass = ''; if ($isOutermost && $outermostItemClass) { $classes[] = $outermostItemClass; $linkClass = $outermostItemClass; } if ($isFirst) { $classes[] = 'first'; } if($menutypes == 'drop_group'){ $classes[] = 'm-dropdown'; } if($level == 0){ $classes[] = 'menu-style-'. $menutypes; } if ($isLast) { $classes[] = 'last'; } if ($hasActiveChildren && $level!=1) { $classes[] = 'parent'; } if ($level==0 && $showblock) { $classes[] = 'parent'; } // prepare list item attributes $attributes = array(); if (count($classes) > 0) { $attributes['class'] = implode(' ', $classes); } if ($hasActiveChildren && !$noEventAttributes) { $attributes['onmouseover'] = 'toggleMenu(this,1)'; $attributes['onmouseout'] = 'toggleMenu(this,0)'; } // assemble list item with attributes $htmlLi = ' $attrValue) { $htmlLi .= ' ' . $attrName . '="' . str_replace('"', '\"', $attrValue) . '"'; } $htmlLi .= '>'; $html[] = $htmlLi; if ($level == 1 && $showblock){ if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_top')){ $html[] = '
'; $html[] = $this->_getCatBlock($catdetail, 'arwmenu_cat_block_top'); $html[] = '
'; } } $title_group=''; if($menutypes=="drop_group"||$menutypes="group") { if($level==1) { $title_group = "title-group"; } } $html[] = ''; $labelCategory = $this->_getCategoryLabelHtml($catdetail, $level); $category_icon= $this->_getCategoryIconHtml($catdetail, $level); $html[] = '' . $category_icon.$labelCategory . $this->escapeHtml($category->getName()).''; $html[] = ''; if($level == 1){ if($imageUrl=$this->_getCategoryImageHtml($catdetail,$level)) { $html[]= ''; } } if ($level == 0) { $cat_block_right = $this->_getCatBlock($catdetail, 'arwmenu_cat_block_right'); $cat_block_left = $this->_getCatBlock($catdetail, 'arwmenu_cat_block_left'); if ($catdetail->getData('arwmenu_proportions_right') || $catdetail->getData('arwmenu_proportions_left')) { $columns = $catdetail->getData('arwmenu_cat_columns'); $proportion_right = $catdetail->getData('arwmenu_proportions_right'); $proportion_left = $catdetail->getData('arwmenu_proportions_left'); } else { if($catdetail->getData('arwmenu_cat_columns')==''){ $columns = 4; }else{ $columns = $catdetail->getData('arwmenu_cat_columns'); } $proportion_right = 1; $proportion_left = 1; } $goups = $proportion_right + $proportion_left; if (empty($cat_block_right) || empty($cat_block_left) || $menutypes == 'drop_group'){ if(empty($cat_block_right)){ $gridCount1 = 'grid12-'.(12 - $proportion_left); $gridCountLeft = 'grid12-' . ($proportion_left); } if(empty($cat_block_left)){ $gridCount1 = 'grid12-'.(12 - $proportion_right); $gridCountRight = 'grid12-' . ($proportion_right); } if(empty($cat_block_right) && empty($cat_block_left)){ $gridCount1 = 'grid12-12'; } } elseif (!$hasActiveChildren){ $gridCountRight = 'grid12-'.$proportion_right; $gridCountLeft = 'grid12-'.$proportion_left; } else { $grid = 12 - $goups; $gridCount1 = 'grid12-' . ($grid); $gridCountRight = 'grid12-' . ($proportion_right); $gridCountLeft = 'grid12-' . ($proportion_left); } $goups = $proportion_right + $proportion_left; } // render children $li = ''; $j = 0; $i = 0; foreach ($activeChildren as $child) { $li .= $this->_renderCategoryMenuGroupItemHtml( $child, ($level + 1), ($j == $activeChildrenCount - 1), ($j == 0), false, $outermostItemClass, $childrenWrapClass, $noEventAttributes ); $j++; } if ($childrenWrapClass && $showblock) { if($menutypes == 'drop_group'){ if($level==1){ $html[] = '
'; }else{ $html[] = '