';
}else{
$html[] = '
';
}
}
if($level==0 && $showblock && $this->_isMomenu == FALSE){
if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_top')){
$html[] = '';
}
if($menutypes != 'dropdown'){
if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_left') && $proportion_left){
$html[] = '';
}
}
}
if (!empty($li) && $hasActiveChildren) {
if($level == 0 && $this->_isMomenu == FALSE){
$colCenter = 'itemgrid itemgrid-'. $columns .'col';
$html[] = '';
}
}
if($level==0 && $showblock && $this->_isMomenu == FALSE){
if($menutypes != 'dropdown'){
if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_right') && $proportion_right){
$html[] = '';
}
}
if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_bottom')){
$html[] = '';
}
}
if ($childrenWrapClass && $showblock && $this->_isMomenu == FALSE) {
$html[] = '
';
}
if ($level == 1 && $showblock && $this->_isMomenu == FALSE){
if($this->_getCatBlock($catdetail, 'arwmenu_cat_block_bottom') && $menutypes != 'dropdown'){
$html[] = '';
}
}
$html[] = '';
$html = implode("\n", $html);
return $html;
}
public function renderCategoriesMenuHtml($momenu = FALSE, $level = 0, $outermostItemClass = '', $childrenWrapClass = '')
{
$this->_isMomenu = $momenu;
$activeCategories = array();
foreach ($this->getStoreCategories() as $child) {
if ($child->getIsActive()) {
$activeCategories[] = $child;
}
}
$activeCategoriesCount = count($activeCategories);
$hasActiveCategoriesCount = ($activeCategoriesCount > 0);
if (!$hasActiveCategoriesCount) {
return '';
}
$html = '';
$j = 0;
foreach ($activeCategories as $category) {
if($this->_isMomenu){
$html .= $this->_renderCategoryMenuItemHtml(
$category,
$level,
($j == $activeCategoriesCount - 1),
($j == 0),
true,
$outermostItemClass,
$childrenWrapClass,
true
);
}else{
$excluded_ids = Mage::getStoreConfig('megamenu/menu/exclude_from_top');
$excluded_ids = explode(',',$excluded_ids);
if (in_array($category->getId(), $excluded_ids)) {
continue;
}
$catdetail = Mage::getModel('catalog/category')->load($category->getId());
$menutype = $catdetail->getData('arwmenu_cat_groups');
switch ($menutype) {
case 'group':
case 'drop_group':
$html .= $this->_renderCategoryMenuGroupItemHtml(
$category,
$level,
($j == $activeCategoriesCount - 1),
($j == 0),
true,
$outermostItemClass,
$childrenWrapClass,
true
);
break;
case 'classic':
case 'dropdown':
$html .= $this->_renderCategoryMenuItemHtml(
$category,
$level,
($j == $activeCategoriesCount - 1),
($j == 0),
true,
$outermostItemClass,
$childrenWrapClass,
true
);
break;
default:
$html .= $this->_renderCategoryMenuGroupItemHtml(
$category,
$level,
($j == $activeCategoriesCount - 1),
($j == 0),
true,
$outermostItemClass,
$childrenWrapClass,
true
);
break;
}
}
$j++;
}
return $html;
}
protected function _getCatBlock($category, $block){
if (!$this->_tplProcessor){
$this->_tplProcessor = Mage::helper('cms')->getBlockTemplateProcessor();
}
return $this->_tplProcessor->filter( trim($category->getData($block)) );
}
protected function _getCategoryLabelHtml($category, $level){
$labelCategory = $category->getData('arwmenu_cat_label');
$category_name = $category->getData('name');
$background_label_category=$category->getData('arwmenu_cat_label_color');
$text_label_category=$category->getData("arwmenu_cat_label_text_color");
$style='background-color:'.$background_label_category.';'.'color:'.$text_label_category;
$attribute_cat_details = Mage::getSingleton("eav/config")->getAttribute("catalog_category", 'arwmenu_cat_label');
// $op_cat_labels = $attribute_cat_details->getSource()->getAllOptions(false);
$op_cat_labels=Mage::getModel('megamenu/system_config_source_category_attribute_source_categorylabel')->getAllOptions();
if ($labelCategory){
foreach ($op_cat_labels as $op )
{
if($op['value']==$labelCategory)
{
$getLabel=$op['label'];
break;
}
}
// $getLabel = trim(Mage::helper('megamenu')->getCfg('category_label/label'));
if ($getLabel) {
$tmp = str_replace('label','',$labelCategory);
if ($level == 0){
return '
' . $getLabel . '';
}else{
return '
' . $getLabel . '';
}
}
}
return '';
}
protected function _getCategoryIconHtml($category, $level){
$category_icon=$category->getData('arwmenu_category_icon');
if($category_icon)
{
if (preg_match("/fa-/i", $category_icon, $match)){
return '
';
}else{
return '
';
}
}
}
protected function _getCategoryImageHtml($category, $level){
return $this->getThumbnailUrl($category,$level);
}
public function getThumbnailUrl($category,$level)
{
$url = false;
if ($image = Mage::getModel('catalog/category')->load($category->getId())->getThumbnail()) {
$url = Mage::getBaseUrl('media').'catalog/category/'.$image;
}
return $url;
}
public function getCategoryLabel()
{
return Mage::helper('megamenu')->getCfg('sidemenu/block_name');
}
}