4. Araxis Merge File Comparison Report

Produced by Araxis Merge on Fri Dec 13 16:40:47 2019 UTC. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a reasonably standards compliant browser such as the latest version of Firefox or Internet Explorer. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

4.1 Files compared

# Location File Last Modified
1 Porto v.3.2.1\Theme Files\Magento 1.x\Porto Theme\app\code\local\Smartwave\Megamenu\Block Navigation.php Tue Feb 20 01:27:56 2018 UTC
2 Porto v.3.2.2\Theme Files\Magento 1.x\Porto Theme\app\code\local\Smartwave\Megamenu\Block Navigation.php Fri Dec 13 13:00:45 2019 UTC

4.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1222
Changed 1 2
Inserted 0 0
Removed 0 0

4.3 Comparison options

Whitespace All differences in whitespace within lines are ignored
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

4.4 Active regular expressions

No regular expressions were active.

4.5 Comparison detail

1   <?php   1   <?php
2     2  
3   class Smar twave_Mega menu_Block _Navigatio n extends  Mage_Catal og_Block_N avigation   3   class Smar twave_Mega menu_Block _Navigatio n extends  Mage_Catal og_Block_N avigation
4   {   4   {
5           pr otected st atic $_mod el;   5           pr otected st atic $_mod el;
6           pr otected st atic $_hel per;   6           pr otected st atic $_hel per;
7           pr otected st atic $_cms _block_mod el;   7           pr otected st atic $_cms _block_mod el;
8           pr otected st atic $_pro cessor;   8           pr otected st atic $_pro cessor;
9           pr otected st atic $_key _current;   9           pr otected st atic $_key _current;
10     10  
11           pr otected fu nction _co nstruct()   11           pr otected fu nction _co nstruct()
12       {   12       {
13                    if ( !self::$_h elper) {   13                    if ( !self::$_h elper) {
14                self::$_ helper = M age::helpe r('megamen u');   14                self::$_ helper = M age::helpe r('megamen u');
15           }   15           }
16           if  (!self::$ _model) {   16           if  (!self::$ _model) {
17                self::$_ model = Ma ge::getMod el('catalo g/category ');   17                self::$_ model = Ma ge::getMod el('catalo g/category ');
18           }   18           }
19                    if ( !self::$_c ms_block_m odel) {   19                    if ( !self::$_c ms_block_m odel) {
20                             self:: $_cms_bloc k_model =  Mage::getM odel('cms/ block');   20                             self:: $_cms_bloc k_model =  Mage::getM odel('cms/ block');
21                    }   21                    }
22                    if ( !self::$_p rocessor)  {   22                    if ( !self::$_p rocessor)  {
23                             $proc_ helper = M age::helpe r('cms');   23                             $proc_ helper = M age::helpe r('cms');
24                             self:: $_processo r = $proc_ helper->ge tPageTempl ateProcess or();   24                             self:: $_processo r = $proc_ helper->ge tPageTempl ateProcess or();
25                    }   25                    }
26                    if ( !self::$_k ey_current ) {   26                    if ( !self::$_k ey_current ) {
27                             self:: $_key_curr ent = $thi s->getCurr entCategor y()->getId ();   27                             self:: $_key_curr ent = $thi s->getCurr entCategor y()->getId ();
28                    }   28                    }
29                       29                    
30       }   30       }
31     31  
32       public  function  drawMegaMe nuItem($ca tegory,$mo de = 'dt',  $level =  0, $last =  false)   32       public  function  drawMegaMe nuItem($ca tegory,$mo de = 'dt',  $level =  0, $last =  false)
33       {   33       {
34           $_ menuHelper  = self::$ _helper;   34           $_ menuHelper  = self::$ _helper;
35           if  (!$catego ry->getIsA ctive()) r eturn '';   35           if  (!$catego ry->getIsA ctive()) r eturn '';
36           $h tml = arra y();   36           $h tml = arra y();
37           $i d = $categ ory->getId ();   37           $i d = $categ ory->getId ();
38           //  --- Block  Options - --   38           //  --- Block  Options - --
39           $a jax_load_p opups = $_ menuHelper ->getConfi g('popup/a jax_load_p opups');   39           $a jax_load_p opups = $_ menuHelper ->getConfi g('popup/a jax_load_p opups');
40           $c atModel =  Mage::getM odel('cata log/catego ry')->load ($id);   40           $c atModel =  Mage::getM odel('cata log/catego ry')->load ($id);
41           $b lockType =  $this->_g etBlocks($ catModel,  'sw_cat_bl ock_type') ;   41           $b lockType =  $this->_g etBlocks($ catModel,  'sw_cat_bl ock_type') ;
42           if  (!$blockT ype || $bl ockType ==  'default' )   42           if  (!$blockT ype || $bl ockType ==  'default' )
43                $blockTy pe = $_men uHelper->g etConfig(' general/wi de_style') ;    //Def ault Forma t is wide  style.   43                $blockTy pe = $_men uHelper->g etConfig(' general/wi de_style') ;    //Def ault Forma t is wide  style.
44           if  ($mode ==  'mb')   44           if  ($mode ==  'mb')
45                $blockTy pe = 'narr ow';   45                $blockTy pe = 'narr ow';
46           $b lock_top =  $block_le ft = $bloc k_right =  $block_bot tom = fals e;   46           $b lock_top =  $block_le ft = $bloc k_right =  $block_bot tom = fals e;
47           if  ($blockTy pe == 'wid e' || $blo ckType ==  'staticwid th') {   47           if  ($blockTy pe == 'wid e' || $blo ckType ==  'staticwid th') {
48                // ---Ge t Static B locks for  category,  only forma t is wide  style, it  is enable.   48                // ---Ge t Static B locks for  category,  only forma t is wide  style, it  is enable.
49                if ($lev el == 0) {   49                if ($lev el == 0) {
50                //  bloc k top of c ategory   50                //  bloc k top of c ategory
51                    $blo ck_top = $ this->_get Blocks($ca tModel, 's w_cat_bloc k_top');   51                    $blo ck_top = $ this->_get Blocks($ca tModel, 's w_cat_bloc k_top');
52                //  bloc k left of  category   52                //  bloc k left of  category
53                    $blo ck_left =  $this->_ge tBlocks($c atModel, ' sw_cat_blo ck_left');   53                    $blo ck_left =  $this->_ge tBlocks($c atModel, ' sw_cat_blo ck_left');
54                //  bloc k left wid th of cate gory   54                //  bloc k left wid th of cate gory
55                    $blo ck_left_wi dth = (int )$this->_g etBlocks($ catModel,  'sw_cat_le ft_block_w idth');   55                    $blo ck_left_wi dth = (int )$this->_g etBlocks($ catModel,  'sw_cat_le ft_block_w idth');
56                    if ( !$block_le ft_width)   56                    if ( !$block_le ft_width)
57                         $block_lef t_width =  3;   57                         $block_lef t_width =  3;
58                //  bloc k right of  category   58                //  bloc k right of  category
59                    $blo ck_right =  $this->_g etBlocks($ catModel,  'sw_cat_bl ock_right' );   59                    $blo ck_right =  $this->_g etBlocks($ catModel,  'sw_cat_bl ock_right' );
60                //  bloc k left wid th of cate gory   60                //  bloc k left wid th of cate gory
61                    $blo ck_right_w idth = (in t)$this->_ getBlocks( $catModel,  'sw_cat_r ight_block _width');   61                    $blo ck_right_w idth = (in t)$this->_ getBlocks( $catModel,  'sw_cat_r ight_block _width');
62                    if ( !$block_ri ght_width)   62                    if ( !$block_ri ght_width)
63                         $block_rig ht_width =  3;   63                         $block_rig ht_width =  3;
64                //  bloc k bottom o f category   64                //  bloc k bottom o f category
65                    $blo ck_bottom  = $this->_ getBlocks( $catModel,  'sw_cat_b lock_botto m');   65                    $blo ck_bottom  = $this->_ getBlocks( $catModel,  'sw_cat_b lock_botto m');
66                }   66                }
67           }   67           }
68              68           
69           //  ---get Ca tegory Lab el---   69           //  ---get Ca tegory Lab el---
70           $c atLabel =  $this->_ge tLabelHtml ($catModel , $level);   70           $c atLabel =  $this->_ge tLabelHtml ($catModel , $level);
71              71           
72           //  --- Sub C ategories  ---   72           //  --- Sub C ategories  ---
73           $a ctiveChild ren = $thi s->_getAct iveChildre n($categor y, $level) ;   73           $a ctiveChild ren = $thi s->_getAct iveChildre n($categor y, $level) ;
74              74           
75           //  --- class  for activ e category  ---   75           //  --- class  for activ e category  ---
76           $a ctive = '' ; if ($thi s->isCateg oryActive( $category) ) $active  = ' act';   76           $a ctive = '' ; if ($thi s->isCateg oryActive( $category) ) $active  = ' act';
77              77           
78           $f loat = $ca tModel->ge tData('sw_ cat_float_ type');   78           $f loat = $ca tModel->ge tData('sw_ cat_float_ type');
79           $h ide_item =  $catModel ->getData( 'sw_cat_hi de_menu_it em');   79           $h ide_item =  $catModel ->getData( 'sw_cat_hi de_menu_it em');
80           if ($float ==  "right")   80           if ($float ==  "right")
81                $float =  "fl-right ";   81                $float =  "fl-right ";
82              82           
83           $s taticWidth  = $catMod el->getDat a('sw_cat_ static_wid th');   83           $s taticWidth  = $catMod el->getDat a('sw_cat_ static_wid th');
84           if (!$staticW idth)   84           if (!$staticW idth)
85                             $stati cWidth = " 500px";   85                             $stati cWidth = " 500px";
86                   86                
87           //  --- categ ory name - --   87           //  --- categ ory name - --
88            $name   =   $ this->esca peHtml($ category-> getName() ) ;   88            $name   =   $
category-> getName()
;
89           if  (Mage::ge tStoreConf ig('megame nu/general /non_break ing_space' )) {   89           if  (Mage::ge tStoreConf ig('megame nu/general /non_break ing_space' )) {
90                $name =  str_replac e(' ', '&n bsp;', $na me);   90                $name =  str_replac e(' ', '&n bsp;', $na me);
91           }   91           }
92              92           
93           //  --- categ ory icon - --   93           //  --- categ ory icon - --
94           $c at_icon_im g = $catMo del->getDa ta('sw_ico n_image');   94           $c at_icon_im g = $catMo del->getDa ta('sw_ico n_image');
95           $c at_font_ic on = $catM odel->getD ata('sw_fo nt_icon');   95           $c at_font_ic on = $catM odel->getD ata('sw_fo nt_icon');
96           $c at_icon =  "";   96           $c at_icon =  "";
97           if ($cat_icon _img){   97           if ($cat_icon _img){
98                $cat_ico n = '<img  class="cat egory-icon " src="'.M age::getBa seUrl('med ia').'cata log/catego ry/'.$cat_ icon_img.' " alt="'.$ name.'"/>' ;   98                $cat_ico n = '<img  class="cat egory-icon " src="'.M age::getBa seUrl('med ia').'cata log/catego ry/'.$cat_ icon_img.' " alt="'.$ name.'"/>' ;
99           }  else if($c at_font_ic on){   99           }  else if($c at_font_ic on){
100                $cat_ico n = '<i cl ass="categ ory-icon ' .$cat_font _icon.'">< /i>';   100                $cat_ico n = '<i cl ass="categ ory-icon ' .$cat_font _icon.'">< /i>';
101           }   101           }
102              102           
103           $d rawPopup =  ($block_t op || $blo ck_left ||  $block_ri ght || $bl ock_bottom  || count( $activeChi ldren));   103           $d rawPopup =  ($block_t op || $blo ck_left ||  $block_ri ght || $bl ock_bottom  || count( $activeChi ldren));
104           if (!$hide_it em){   104           if (!$hide_it em){
105           if  ($drawPop up) {   105           if  ($drawPop up) {
106                //Has su bcategorie s or stati c blocks   106                //Has su bcategorie s or stati c blocks
107                if ($blo ckType ==  'wide') {   107                if ($blo ckType ==  'wide') {
108                    $par entClass =  'menu-ful l-width';   108                    $par entClass =  'menu-ful l-width';
109                } else i f ($blockT ype == 'st aticwidth' ) {   109                } else i f ($blockT ype == 'st aticwidth' ) {
110                    $par entClass =  'menu-sta tic-width' ;   110                    $par entClass =  'menu-sta tic-width' ;
111                } else {   111                } else {
112                    $par entClass =  'menu-ite m menu-ite m-has-chil dren menu- parent-ite m';   112                    $par entClass =  'menu-ite m menu-ite m-has-chil dren menu- parent-ite m';
113                }   113                }
114                $data_id  = '';   114                $data_id  = '';
115                if($ajax _load_popu ps) {   115                if($ajax _load_popu ps) {
116                    $dat a_id = 'da ta-id = "' .$id.'"';   116                    $dat a_id = 'da ta-id = "' .$id.'"';
117                }   117                }
118                $html[]  = '<li cla ss="'.$par entClass.'  '.$active .' '.$floa t.'" '.$da ta_id.'>';   118                $html[]  = '<li cla ss="'.$par entClass.'  '.$active .' '.$floa t.'" '.$da ta_id.'>';
119                $html[]  = '<a href ="'.$this- >getCatego ryUrl($cat egory).'"> '.$cat_ico n.$name.$c atLabel.'< /a>';   119                $html[]  = '<a href ="'.$this- >getCatego ryUrl($cat egory).'"> '.$cat_ico n.$name.$c atLabel.'< /a>';
120                   120                
121                if ($mod e != 'mb')  {   121                if ($mod e != 'mb')  {
122                    if($ blockType  == 'static width'){   122                    if($ blockType  == 'static width'){
123                         $html[] =  '<div clas s="nav-sub list-dropd own" style ="display:  none; wid th:'.$stat icWidth.'; ">';   123                         $html[] =  '<div clas s="nav-sub list-dropd own" style ="display:  none; wid th:'.$stat icWidth.'; ">';
124                         $html[] =  '<div clas s="contain er">';   124                         $html[] =  '<div clas s="contain er">';
125                    } el se {   125                    } el se {
126                         $html[] =  '<div clas s="nav-sub list-dropd own" style ="display:  none;">';   126                         $html[] =  '<div clas s="nav-sub list-dropd own" style ="display:  none;">';
127                         $html[] =  '<div clas s="contain er">';   127                         $html[] =  '<div clas s="contain er">';
128                    }   128                    }
129                }   129                }
130                if(!$aja x_load_pop ups || $mo de == 'mb' ) {   130                if(!$aja x_load_pop ups || $mo de == 'mb' ) {
131                    if ( $level ==  0 && ($blo ckType ==  'wide' ||  $blockType  == 'stati cwidth') )  {   131                    if ( $level ==  0 && ($blo ckType ==  'wide' ||  $blockType  == 'stati cwidth') )  {
132                         if ($block _top)   132                         if ($block _top)
133                             $html[ ] = '<div  class="top -mega-bloc k">' . $bl ock_top .  '</div>';   133                             $html[ ] = '<div  class="top -mega-bloc k">' . $bl ock_top .  '</div>';
134                         $html[] =  '<div clas s="mega-co lumns row" >';   134                         $html[] =  '<div clas s="mega-co lumns row" >';
135                         if ($block _left)   135                         if ($block _left)
136                             $html[ ] = '<div  class="lef t-mega-blo ck col-sm- '.$block_l eft_width. '">' . $bl ock_left .  '</div>';   136                             $html[ ] = '<div  class="lef t-mega-blo ck col-sm- '.$block_l eft_width. '">' . $bl ock_left .  '</div>';
137                         if (count( $activeChi ldren)) {   137                         if (count( $activeChi ldren)) {
138                             //colu mns for ca tegory   138                             //colu mns for ca tegory
139                             $colum ns = (int) $catModel- >getData(' sw_cat_blo ck_columns ');   139                             $colum ns = (int) $catModel- >getData(' sw_cat_blo ck_columns ');
140                             if (!$ columns)   140                             if (!$ columns)
141                                 $c olumns = 6 ;   141                                 $c olumns = 6 ;
142                                142                             
143                             //colu mns item w idth   143                             //colu mns item w idth
144                             $colum nsWidth =  12;   144                             $colum nsWidth =  12;
145                             if ($b lock_left)   145                             if ($b lock_left)
146                                 $c olumnsWidt h = $colum nsWidth -  $block_lef t_width;   146                                 $c olumnsWidt h = $colum nsWidth -  $block_lef t_width;
147                             if ($b lock_right )   147                             if ($b lock_right )
148                                 $c olumnsWidt h = $colum nsWidth -  $block_rig ht_width;   148                                 $c olumnsWidt h = $colum nsWidth -  $block_rig ht_width;
149                                    149                                 
150                             //draw  category  menu items   150                             //draw  category  menu items
151                             $html[ ] = '<div  class="blo ck1 col-sm -'.$column sWidth.'"> ';   151                             $html[ ] = '<div  class="blo ck1 col-sm -'.$column sWidth.'"> ';
152                             $html[ ] = '<div  class="sw- row">';                         152                             $html[ ] = '<div  class="sw- row">';                      
153                             $html[ ] = '<ul>' ;   153                             $html[ ] = '<ul>' ;
154                             $html[ ] = $this- >drawColum ns($active Children,  $columns,  count($act iveChildre n),'', 'wi de');   154                             $html[ ] = $this- >drawColum ns($active Children,  $columns,  count($act iveChildre n),'', 'wi de');
155                             $html[ ] = '</ul> ';   155                             $html[ ] = '</ul> ';
156                             $html[ ] = '</div >';   156                             $html[ ] = '</div >';
157                             $html[ ] = '</div >';   157                             $html[ ] = '</div >';
158                         }   158                         }
159                         if ($block _right)   159                         if ($block _right)
160                             $html[ ] = '<div  class="rig ht-mega-bl ock col-sm -'.$block_ right_widt h.'">' . $ block_righ t . '</div >';   160                             $html[ ] = '<div  class="rig ht-mega-bl ock col-sm -'.$block_ right_widt h.'">' . $ block_righ t . '</div >';
161                         $html[] =  '</div>';   161                         $html[] =  '</div>';
162                                          /* F ixed from  version 1. 0.1 */   162                                          /* F ixed from  version 1. 0.1 */
163                                          //ve rion 1.0.1  start   163                                          //ve rion 1.0.1  start
164                         if ($block _bottom)   164                         if ($block _bottom)
165                             $html[ ] = '<div  class="bot tom-mega-b lock">' .  $block_bot tom . '</d iv>';   165                             $html[ ] = '<div  class="bot tom-mega-b lock">' .  $block_bot tom . '</d iv>';
166                                          //ve rsion 1.0. 1 end   166                                          //ve rsion 1.0. 1 end
167                    } el se if ($le vel == 0 & & $blockTy pe == 'nar row') {                     167                    } el se if ($le vel == 0 & & $blockTy pe == 'nar row') {                  
168                         $html[] =  '<ul>';   168                         $html[] =  '<ul>';
169                         $html[] =  $this->dra wColumns($ activeChil dren, '',  count($act iveChildre n),'','nar row', $mod e);   169                         $html[] =  $this->dra wColumns($ activeChil dren, '',  count($act iveChildre n),'','nar row', $mod e);
170                         $html[] =  '</ul>';   170                         $html[] =  '</ul>';
171                    }   171                    }
172                } else {   172                } else {
173                    $htm l[] = '<di v style="p adding: 30 px 0; text -align: ce nter;"><i  class="aja x-loader s mall anima te-spin">< /i></div>' ;   173                    $htm l[] = '<di v style="p adding: 30 px 0; text -align: ce nter;"><i  class="aja x-loader s mall anima te-spin">< /i></div>' ;
174                }   174                }
175                if ($mod e != 'mb')  {   175                if ($mod e != 'mb')  {
176                    $htm l[] = '</d iv>';   176                    $htm l[] = '</d iv>';
177                    $htm l[] = '</d iv>';      177                    $htm l[] = '</d iv>';   
178                }   178                }
179                $html[]  = '</li>';   179                $html[]  = '</li>';
180           }  else {   180           }  else {
181                //Has no  subcatego ries and s tatic bloc ks   181                //Has no  subcatego ries and s tatic bloc ks
182                $html[]  = '<li cla ss="'.$act ive.' '.$f loat.'">';   182                $html[]  = '<li cla ss="'.$act ive.' '.$f loat.'">';
183                $html[]  = '<a href ="'.$this- >getCatego ryUrl($cat egory).'"> '.$cat_ico n.$name.$c atLabel.'< /a>';   183                $html[]  = '<a href ="'.$this- >getCatego ryUrl($cat egory).'"> '.$cat_ico n.$name.$c atLabel.'< /a>';
184                $html[]  = '</li>';   184                $html[]  = '</li>';
185           }   185           }
186           }   186           }
187           $h tml = impl ode("\n",  $html);   187           $h tml = impl ode("\n",  $html);
188           re turn $html ;   188           re turn $html ;
189       }   189       }
190          190       
191   //    cust om block    191   //    cust om block 
192       public  function  drawCustom Block()    192       public  function  drawCustom Block() 
193       {   193       {
194           $_ menuHelper  = self::$ _helper;   194           $_ menuHelper  = self::$ _helper;
195           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_b lock');            195           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_b lock');         
196           if  (!$blockI ds) return ;   196           if  (!$blockI ds) return ;
197              197           
198           $h tml = arra y();   198           $h tml = arra y();
199           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);   199           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);
200           $I Ds = explo de(',', $b lockIds);   200           $I Ds = explo de(',', $b lockIds);
201           fo reach ($ID s as $bloc kId) {   201           fo reach ($ID s as $bloc kId) {
202                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);                202                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);             
203                if (!$bl ock) conti nue;   203                if (!$bl ock) conti nue;
204                                204                             
205                $blockTi tle = $blo ck->getTit le();                205                $blockTi tle = $blo ck->getTit le();             
206                $blockCo ntent = $b lock->getC ontent();    206                $blockCo ntent = $b lock->getC ontent(); 
207                $blockCo ntent = se lf::$_proc essor->fil ter($block Content);   207                $blockCo ntent = se lf::$_proc essor->fil ter($block Content);
208                if (!$bl ockContent ) continue ;   208                if (!$bl ockContent ) continue ;
209                $html[]  = '<li cla ss="menu-f ull-width" >';   209                $html[]  = '<li cla ss="menu-f ull-width" >';
210                $html[]  = '<a href ="javascri pt:void(); " rel="#"> ';   210                $html[]  = '<a href ="javascri pt:void(); " rel="#"> ';
211                if ($_me nuHelper-> getConfig( 'general/n on_breakin g_space'))  {   211                if ($_me nuHelper-> getConfig( 'general/n on_breakin g_space'))  {
212                    $blo ckTitle =  str_replac e(' ', '&n bsp;', $bl ockTitle);   212                    $blo ckTitle =  str_replac e(' ', '&n bsp;', $bl ockTitle);
213                }   213                }
214                $html[]  = $blockTi tle;   214                $html[]  = $blockTi tle;
215                $html[]  = '</a>';   215                $html[]  = '</a>';
216                $html[]  = '<div cl ass="nav-s ublist-dro pdown">';   216                $html[]  = '<div cl ass="nav-s ublist-dro pdown">';
217                $html[]  = '<div cl ass="conta iner">';   217                $html[]  = '<div cl ass="conta iner">';
218                $html[]  = $blockCo ntent;   218                $html[]  = $blockCo ntent;
219                $html[]  = '</div>' ;   219                $html[]  = '</div>' ;
220                $html[]  = '</div>' ;                220                $html[]  = '</div>' ;             
221                $html[]  = '</li>';   221                $html[]  = '</li>';
222           }   222           }
223           if  (!$html)  return;   223           if  (!$html)  return;
224           $h tml = impl ode("\n",  $html);   224           $h tml = impl ode("\n",  $html);
225           re turn $html ;   225           re turn $html ;
226       }   226       }
227          227       
228       public  function  drawCustom MobileLink s()   228       public  function  drawCustom MobileLink s()
229       {   229       {
230           $_ menuHelper  = self::$ _helper;   230           $_ menuHelper  = self::$ _helper;
231           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_m obile_link s');            231           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_m obile_link s');         
232           if  (!$blockI ds) return ;   232           if  (!$blockI ds) return ;
233              233           
234           $h tml = arra y();   234           $h tml = arra y();
235           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);   235           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);
236           $I Ds = explo de(',', $b lockIds);   236           $I Ds = explo de(',', $b lockIds);
237           fo reach ($ID s as $bloc kId) {   237           fo reach ($ID s as $bloc kId) {
238                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);   238                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);
239                if (!$bl ock) conti nue;   239                if (!$bl ock) conti nue;
240                $menuIte mContent =  $block->g etContent( );   240                $menuIte mContent =  $block->g etContent( );
241                $menuIte mContent =  self::$_p rocessor-> filter($me nuItemCont ent);   241                $menuIte mContent =  self::$_p rocessor-> filter($me nuItemCont ent);
242                if(subst r($menuIte mContent,  0, 4) == ' <ul>') {   242                if(subst r($menuIte mContent,  0, 4) == ' <ul>') {
243                    $men uItemConte nt = subst r($menuIte mContent,  4);                    243                    $men uItemConte nt = subst r($menuIte mContent,  4);                 
244                }   244                }
245                if(subst r($menuIte mContent,  strlen($me nuItemCont ent) - 5)  == '</ul>' ) {   245                if(subst r($menuIte mContent,  strlen($me nuItemCont ent) - 5)  == '</ul>' ) {
246                    $men uItemConte nt = subst r($menuIte mContent,  0, - 5);                     246                    $men uItemConte nt = subst r($menuIte mContent,  0, - 5);                  
247                }   247                }
248                $html[]  = $menuIte mContent;    248                $html[]  = $menuIte mContent; 
249           }   249           }
250           if  (!$html)  return;   250           if  (!$html)  return;
251           $h tml = impl ode("\n",  $html);   251           $h tml = impl ode("\n",  $html);
252           re turn $html ;   252           re turn $html ;
253       }   253       }
254          254       
255       public  function  drawCustom Links()   255       public  function  drawCustom Links()
256       {   256       {
257           $_ menuHelper  = self::$ _helper;   257           $_ menuHelper  = self::$ _helper;
258           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_l inks');   258           $b lockIds =  $_menuHelp er->getCon fig('custo m/custom_l inks');
259           if  (!$blockI ds) return ;           259           if  (!$blockI ds) return ;        
260              260           
261           $h tml = arra y();   261           $h tml = arra y();
262           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);   262           $b lockIds =  preg_repla ce('/\s/',  '', $bloc kIds);
263           $I Ds = explo de(',', $b lockIds);   263           $I Ds = explo de(',', $b lockIds);
264           fo reach($IDs  as $block Id) {   264           fo reach($IDs  as $block Id) {
265                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);   265                $block =  self::$_c ms_block_m odel->setS toreId(Mag e::app()-> getStore() ->getId()) ->load($bl ockId);
266                if (!$bl ock) conti nue;   266                if (!$bl ock) conti nue;
267                $menuIte mContent =  $block->g etContent( );   267                $menuIte mContent =  $block->g etContent( );
268                $menuIte mContent =  self::$_p rocessor-> filter($me nuItemCont ent);     268                $menuIte mContent =  self::$_p rocessor-> filter($me nuItemCont ent);  
269                if(subst r($menuIte mContent,  0, 4) == ' <ul>') {   269                if(subst r($menuIte mContent,  0, 4) == ' <ul>') {
270                    $men uItemConte nt = subst r($menuIte mContent,  4);                    270                    $men uItemConte nt = subst r($menuIte mContent,  4);                 
271                }   271                }
272                if(subst r($menuIte mContent,  strlen($me nuItemCont ent) - 5)  == '</ul>' ) {   272                if(subst r($menuIte mContent,  strlen($me nuItemCont ent) - 5)  == '</ul>' ) {
273                    $men uItemConte nt = subst r($menuIte mContent,  0, - 5);                     273                    $men uItemConte nt = subst r($menuIte mContent,  0, - 5);                  
274                }   274                }
275                $html[]  = $menuIte mContent;       275                $html[]  = $menuIte mContent;    
276           }   276           }
277           if  (!$html)  return;   277           if  (!$html)  return;
278              278           
279           $h tml = impl ode("\n",  $html);   279           $h tml = impl ode("\n",  $html);
280           re turn $html ;   280           re turn $html ;
281       }   281       }
282       public  function  drawMenuIt em($childr en, $level  = 1, $typ e, $width,  $mode = ' dt')   282       public  function  drawMenuIt em($childr en, $level  = 1, $typ e, $width,  $mode = ' dt')
283       {   283       {
284           $k eyCurrent  = self::$_ key_curren t;   284           $k eyCurrent  = self::$_ key_curren t;
285           $h tml = '';            285           $h tml = '';         
286           fo reach ($ch ildren as  $child)   286           fo reach ($ch ildren as  $child)
287           {   287           {
288                if (is_o bject($chi ld) && $ch ild->getIs Active())   288                if (is_o bject($chi ld) && $ch ild->getIs Active())
289                {   289                {
290                    $act iveChildre n = $this- >_getActiv eChildren( $child, $l evel);   290                    $act iveChildre n = $this- >_getActiv eChildren( $child, $l evel);
291                    // - -- class f or active  category - --   291                    // - -- class f or active  category - --
292                    $id  = $child-> getId();   292                    $id  = $child-> getId();
293                    // - -- Static  Block ---   293                    // - -- Static  Block ---
294                    $cat Model = Ma ge::getMod el('catalo g/category ')->load($ id);   294                    $cat Model = Ma ge::getMod el('catalo g/category ')->load($ id);
295                    $act ive = '';   295                    $act ive = '';
296                    if ( $this->isC ategoryAct ive($child ))   296                    if ( $this->isC ategoryAct ive($child ))
297                    {   297                    {
298                         $active =  ' actParen t';   298                         $active =  ' actParen t';
299                         if ($child ->getId()  == $keyCur rent) $act ive = ' ac t';   299                         if ($child ->getId()  == $keyCur rent) $act ive = ' ac t';
300                    }   300                    }
301                    // - --category  label   301                    // - --category  label
302                    $lab el = $this ->_getLabe lHtml($cat Model, $le vel);   302                    $lab el = $this ->_getLabe lHtml($cat Model, $le vel);
303                    // - -- format  category n ame ---   303                    // - -- format  category n ame ---
304                    $nam e = $this- >escapeHtm l($child-> getName()) ;   304                    $nam e = $this- >escapeHtm l($child-> getName()) ;
305                    if ( Mage::getS toreConfig ('megamenu /general/n on_breakin g_space'))   305                    if ( Mage::getS toreConfig ('megamenu /general/n on_breakin g_space'))
306                         $name = st r_replace( ' ', '&nbs p;', $name );   306                         $name = st r_replace( ' ', '&nbs p;', $name );
307                    $cla ss = 'menu -item';   307                    $cla ss = 'menu -item';
308                    if ( count($act iveChildre n) > 0) {   308                    if ( count($act iveChildre n) > 0) {
309                         $class .=  ' menu-ite m-has-chil dren menu- parent-ite m';   309                         $class .=  ' menu-ite m-has-chil dren menu- parent-ite m';
310                    }   310                    }
311                    $hid e_item = $ catModel-> getData('s w_cat_hide _menu_item ');   311                    $hid e_item = $ catModel-> getData('s w_cat_hide _menu_item ');
312                    if(! $hide_item ){   312                    if(! $hide_item ){
313                    if ( $level ==  1) {   313                    if ( $level ==  1) {
314                         if ($type  == 'wide')  {   314                         if ($type  == 'wide')  {
315                             //$cla ss .= ' co l-sm-'.$wi dth;  ---v ersion 1.0 .0---   315                             //$cla ss .= ' co l-sm-'.$wi dth;  ---v ersion 1.0 .0---
316                                                       $c lass .= '  col-sw-'.$ width; //  --- versio n 1.0.2   316                                                       $c lass .= '  col-sw-'.$ width; //  --- versio n 1.0.2
317                         }                         317                         }                      
318                         $html .= ' <li class= "'.$class. ' '.$activ e.' ">';   318                         $html .= ' <li class= "'.$class. ' '.$activ e.' ">';
319                                               //added fr om version  1.0.2   319                                               //added fr om version  1.0.2
320                                               //version  1.0.2 star t   320                                               //version  1.0.2 star t
321                                               if ($type  == 'wide'  && $catMod el->getThu mbnail())  {   321                                               if ($type  == 'wide'  && $catMod el->getThu mbnail())  {
322                                                       $h tml .= '<d iv class=" menu_thumb _img">';   322                                                       $h tml .= '<d iv class=" menu_thumb _img">';
323                                                       $h tml .= '<a  class="me nu_thumb_l ink" href= "'. $this- >getCatego ryUrl($chi ld) .'">';   323                                                       $h tml .= '<a  class="me nu_thumb_l ink" href= "'. $this- >getCatego ryUrl($chi ld) .'">';
324                                                       $h tml .= '<i mg src="'  . Mage::ge tBaseUrl(' media').'c atalog/cat egory/' .  $catModel- >getThumbn ail() . '"  alt="' .  Mage::help er('catalo g/output') ->__("Thum bnail Imag e").'" />' ;   324                                                       $h tml .= '<i mg src="'  . Mage::ge tBaseUrl(' media').'c atalog/cat egory/' .  $catModel- >getThumbn ail() . '"  alt="' .  Mage::help er('catalo g/output') ->__("Thum bnail Imag e").'" />' ;
325                                                       $h tml .= '</ a>';   325                                                       $h tml .= '</ a>';
326                                                       $h tml .= '</ div>';   326                                                       $h tml .= '</ div>';
327                                               }   327                                               }
328                                               //version  1.0.2 end   328                                               //version  1.0.2 end
329                         $html.= '< a class="l evel' . $l evel . '"  data-id="' .$child->g etId().'"  href="' .  $this->get CategoryUr l($child)  . '"><span >' . $name  .$label.  '</span></ a>';   329                         $html.= '< a class="l evel' . $l evel . '"  data-id="' .$child->g etId().'"  href="' .  $this->get CategoryUr l($child)  . '"><span >' . $name  .$label.  '</span></ a>';
330                    } el se {   330                    } el se {
331                         $html .= ' <li class= "'.$class. ' '.$activ e.'">';   331                         $html .= ' <li class= "'.$class. ' '.$activ e.'">';
332                         $html .= ' <a class=" level' . $ level . '"  data-id=" '.$child-> getId().'"  href="' .  $this->ge tCategoryU rl($child)  . '"><spa n>' . $nam e .$label.  '</span>< /a>';   332                         $html .= ' <a class=" level' . $ level . '"  data-id=" '.$child-> getId().'"  href="' .  $this->ge tCategoryU rl($child)  . '"><spa n>' . $nam e .$label.  '</span>< /a>';
333                    }   333                    }
334                    if ( count($act iveChildre n) > 0)   334                    if ( count($act iveChildre n) > 0)
335                    {   335                    {
336                         if ($mode  != 'mb') {   336                         if ($mode  != 'mb') {
337                             $html. = '<div cl ass="nav-s ublist lev el' . $lev el . '">';       337                             $html. = '<div cl ass="nav-s ublist lev el' . $lev el . '">';    
338                         }   338                         }
339                         $html.= '< ul>';   339                         $html.= '< ul>';
340                         $html.= $t his->drawM enuItem($a ctiveChild ren, $leve l + 1, $ty pe, $width , $mode);   340                         $html.= $t his->drawM enuItem($a ctiveChild ren, $leve l + 1, $ty pe, $width , $mode);
341                         $html.= '< /ul>';                         341                         $html.= '< /ul>';                      
342                         if ($mode  != 'mb') {   342                         if ($mode  != 'mb') {
343                             $html. = '</div>' ;      343                             $html. = '</div>' ;   
344                         }   344                         }
345                    }   345                    }
346                    $htm l .= '</li >';   346                    $htm l .= '</li >';
347                    }   347                    }
348                }   348                }
349           }            349           }         
350           re turn $html ;   350           re turn $html ;
351       }   351       }
352     352  
353       public  function  drawColumn s($childre n, $column s = 1, $ca tNum = 1,  $catLabel  = '', $typ e, $mode =  'dt')   353       public  function  drawColumn s($childre n, $column s = 1, $ca tNum = 1,  $catLabel  = '', $typ e, $mode =  'dt')
354       {   354       {
355           $h tml = '';            355           $h tml = '';         
356           //  --- explo de by colu mns ---   356           //  --- explo de by colu mns ---
357                    //-- -- updated  from vers ion 1.0.2  ----   357                    //-- -- updated  from vers ion 1.0.2  ----
358                    //ve rsion 1.0.   358                    //ve rsion 1.0.
359           // if ($colum ns < 1) $c olumns = 1 ;   359           // if ($colum ns < 1) $c olumns = 1 ;
360           // $colWidth  = 12 / $co lumns;     360           // $colWidth  = 12 / $co lumns;  
361                       361                    
362                    //ve rsion 1.0. 2 start   362                    //ve rsion 1.0. 2 start
363                    if ( $columns <  1) $colWi dth = 4;   363                    if ( $columns <  1) $colWi dth = 4;
364                    $col Width = $c olumns;   364                    $col Width = $c olumns;
365                    //ve rsion 1.0. 2 end   365                    //ve rsion 1.0. 2 end
366     366  
367           $c hunks = $t his->_expl odeByColum ns($childr en, $colum ns, $catNu m);            367           $c hunks = $t his->_expl odeByColum ns($childr en, $colum ns, $catNu m);         
368     368  
369           //  --- draw  columns -- -   369           //  --- draw  columns -- -
370           $l astColumnN umber = co unt($chunk s);            370           $l astColumnN umber = co unt($chunk s);         
371           $i  = 1;   371           $i  = 1;
372           fo reach ($ch unks as $k ey => $val ue)   372           fo reach ($ch unks as $k ey => $val ue)
373           {   373           {
374                if ($typ e == 'wide ') {   374                if ($typ e == 'wide ') {
375                    //$c lass = 'co l-sm-'.$co lWidth; -- -version 1 .0.0---   375                    //$c lass = 'co l-sm-'.$co lWidth; -- -version 1 .0.0---
376                                      $class =  'col-sw-' .$colWidth ; //---ver sion 1.0.2 ---   376                                      $class =  'col-sw-' .$colWidth ; //---ver sion 1.0.2 ---
377                    if ( !count($va lue)) cont inue;                     377                    if ( !count($va lue)) cont inue;                  
378                    $htm l.= $this- >drawMenuI tem($value , 1, $type , $colWidt h);                    378                    $htm l.= $this- >drawMenuI tem($value , 1, $type , $colWidt h);                 
379   //                 if  ($i == $c olWidth)   379   //                 if  ($i == $c olWidth)
380   //                      $html .=  '<div cla ss="clearf ix"></div> ';   380   //                      $html .=  '<div cla ss="clearf ix"></div> ';
381                } else {   381                } else {
382                    $htm l .= $this ->drawMenu Item($valu e, 1,'','' ,$mode);   382                    $htm l .= $this ->drawMenu Item($valu e, 1,'','' ,$mode);
383                }   383                }
384                $i++;   384                $i++;
385           }   385           }
386              386           
387           re turn $html ;   387           re turn $html ;
388       }   388       }
389     389  
390       public  function  _getActive Children($ parent, $l evel)   390       public  function  _getActive Children($ parent, $l evel)
391       {   391       {
392           $a ctiveChild ren = arra y();   392           $a ctiveChild ren = arra y();
393           //  --- check  level ---   393           //  --- check  level ---
394           $m axLevel =  (int)Mage: :getStoreC onfig('meg amenu/gene ral/max_le vel');   394           $m axLevel =  (int)Mage: :getStoreC onfig('meg amenu/gene ral/max_le vel');
395           if  ($maxLeve l > 0)   395           if  ($maxLeve l > 0)
396           {   396           {
397                if ($lev el >= ($ma xLevel - 1 )) return  $activeChi ldren;   397                if ($lev el >= ($ma xLevel - 1 )) return  $activeChi ldren;
398           }   398           }
399           //  --- / che ck level - --   399           //  --- / che ck level - --
400           if  (Mage::he lper('cata log/catego ry_flat')- >isEnabled ())   400           if  (Mage::he lper('cata log/catego ry_flat')- >isEnabled ())
401           {   401           {
402                $childre n = $paren t->getChil drenNodes( );   402                $childre n = $paren t->getChil drenNodes( );
403                $childre nCount = c ount($chil dren);   403                $childre nCount = c ount($chil dren);
404           }   404           }
405           el se   405           el se
406           {   406           {
407                $childre n = Mage:: getModel(' catalog/ca tegory')-> getCategor ies($paren t->getId() );   407                $childre n = Mage:: getModel(' catalog/ca tegory')-> getCategor ies($paren t->getId() );
408                $childre nCount = c ount($chil dren);   408                $childre nCount = c ount($chil dren);
409           }   409           }
410           $h asChildren  = $childr en && $chi ldrenCount ;   410           $h asChildren  = $childr en && $chi ldrenCount ;
411           if  ($hasChil dren)   411           if  ($hasChil dren)
412           {   412           {
413                foreach  ($children  as $child )   413                foreach  ($children  as $child )
414                {   414                {
415                    if ( $this->_is CategoryDi splayed($c hild))   415                    if ( $this->_is CategoryDi splayed($c hild))
416                    {   416                    {
417                         array_push ($activeCh ildren, $c hild);   417                         array_push ($activeCh ildren, $c hild);
418                    }   418                    }
419                }   419                }
420           }   420           }
421           re turn $acti veChildren ;   421           re turn $acti veChildren ;
422       }   422       }
423     423  
424           pr ivate func tion _isCa tegoryDisp layed(&$ch ild)   424           pr ivate func tion _isCa tegoryDisp layed(&$ch ild)
425       {   425       {
426           if  (!$child- >getIsActi ve()) retu rn false;   426           if  (!$child- >getIsActi ve()) retu rn false;
427           //  === check  products  count ===   427           //  === check  products  count ===
428           //  --- get c ollection  info ---   428           //  --- get c ollection  info ---
429           if  (!Mage::g etStoreCon fig('megam enu/genera l/display_ empty_cate gories'))   429           if  (!Mage::g etStoreCon fig('megam enu/genera l/display_ empty_cate gories'))
430           {   430           {
431                $data =  $this->_ge tProductsC ountData() ;   431                $data =  $this->_ge tProductsC ountData() ;
432                // --- c heck by id  ---   432                // --- c heck by id  ---
433                $id = $c hild->getI d();   433                $id = $c hild->getI d();
434                #Mage::l og($id); M age::log($ data);   434                #Mage::l og($id); M age::log($ data);
435                if (!iss et($data[$ id]) || !$ data[$id][ 'product_c ount']) re turn false ;   435                if (!iss et($data[$ id]) || !$ data[$id][ 'product_c ount']) re turn false ;
436           }   436           }
437           //  === / che ck product s count == =   437           //  === / che ck product s count == =
438           re turn true;   438           re turn true;
439       }   439       }
440     440  
441           pr ivate func tion _getP roductsCou ntData()   441           pr ivate func tion _getP roductsCou ntData()
442       {   442       {
443           if  (is_null( $this->_pr oductsCoun t))   443           if  (is_null( $this->_pr oductsCoun t))
444           {   444           {
445                $collect ion = Mage ::getModel ('catalog/ category') ->getColle ction();   445                $collect ion = Mage ::getModel ('catalog/ category') ->getColle ction();
446                $storeId  = Mage::a pp()->getS tore()->ge tId();   446                $storeId  = Mage::a pp()->getS tore()->ge tId();
447                /* @var  $collectio n Mage_Cat alog_Model _Resource_ Eav_Mysql4 _Category_ Collection  */   447                /* @var  $collectio n Mage_Cat alog_Model _Resource_ Eav_Mysql4 _Category_ Collection  */
448                $collect ion->addAt tributeToS elect('nam e')   448                $collect ion->addAt tributeToS elect('nam e')
449                    ->ad dAttribute ToSelect(' is_active' )   449                    ->ad dAttribute ToSelect(' is_active' )
450                    ->se tStoreId($ storeId);   450                    ->se tStoreId($ storeId);
451                if(!Mage ::helper(' catalog/ca tegory_fla t')->isEna bled()){   451                if(!Mage ::helper(' catalog/ca tegory_fla t')->isEna bled()){
452                    $col lection->s etProductS toreId($st oreId)   452                    $col lection->s etProductS toreId($st oreId)
453                         ->setLoadP roductCoun t(true);   453                         ->setLoadP roductCoun t(true);
454                }   454                }
455                $product sCount = a rray();   455                $product sCount = a rray();
456                foreach( $collectio n as $cat)   456                foreach( $collectio n as $cat)
457                {   457                {
458                    $pro ductsCount [$cat->get Id()] = ar ray(   458                    $pro ductsCount [$cat->get Id()] = ar ray(
459                         'name' =>  $cat->getN ame(),   459                         'name' =>  $cat->getN ame(),
460                         'product_c ount' => $ cat->getPr oductCount (),   460                         'product_c ount' => $ cat->getPr oductCount (),
461                    );   461                    );
462                }   462                }
463                #Mage::l og($produc tsCount);   463                #Mage::l og($produc tsCount);
464                $this->_ productsCo unt = $pro ductsCount ;   464                $this->_ productsCo unt = $pro ductsCount ;
465           }   465           }
466           re turn $this ->_product sCount;   466           re turn $this ->_product sCount;
467       }   467       }
468     468  
469           pr ivate func tion _expl odeByColum ns($target , $num, $c atNum)   469           pr ivate func tion _expl odeByColum ns($target , $num, $c atNum)
470       {   470       {
471           $t arget = se lf::_explo deArrayByC olumnsHori sontal($ta rget, $num , $catNum) ;   471           $t arget = se lf::_explo deArrayByC olumnsHori sontal($ta rget, $num , $catNum) ;
472              472           
473           #r eturn $tar get;   473           #r eturn $tar get;
474   //         if ((int)M age::getSt oreConfig( 'megamenu/ columns/in tegrate')  && count($ target))   474   //         if ((int)M age::getSt oreConfig( 'megamenu/ columns/in tegrate')  && count($ target))
475           if  (count($t arget))   475           if  (count($t arget))
476           {   476           {
477                // --- c ombine con sistently  numericall y small co lumn ---   477                // --- c ombine con sistently  numericall y small co lumn ---
478                // --- 1 . calc len gth of eac h column - --   478                // --- 1 . calc len gth of eac h column - --
479                $max = 0 ; $columns Length = a rray();   479                $max = 0 ; $columns Length = a rray();
480                foreach  ($target a s $key =>  $child)   480                foreach  ($target a s $key =>  $child)
481                {   481                {
482                    $cou nt = 0;   482                    $cou nt = 0;
483                    $thi s->_countC hild($chil d, 1, $cou nt);   483                    $thi s->_countC hild($chil d, 1, $cou nt);
484                    if ( $max < $co unt) $max  = $count;   484                    if ( $max < $co unt) $max  = $count;
485                    $col umnsLength [$key] = $ count;   485                    $col umnsLength [$key] = $ count;
486                }   486                }
487                // --- 2 . merge sm all column s with nex t ---   487                // --- 2 . merge sm all column s with nex t ---
488                $xColumn s = array( ); $column  = array() ; $cnt = 0 ;   488                $xColumn s = array( ); $column  = array() ; $cnt = 0 ;
489                $xColumn sLength =  array(); $ k = 0;   489                $xColumn sLength =  array(); $ k = 0;
490                foreach  ($columnsL ength as $ key => $co unt)   490                foreach  ($columnsL ength as $ key => $co unt)
491                {   491                {
492                    $cnt += $count;   492                    $cnt += $count;
493                    if ( $cnt > $ma x && count ($column))   493                    if ( $cnt > $ma x && count ($column))
494                    {   494                    {
495                         $xColumns[ $k] = $col umn;   495                         $xColumns[ $k] = $col umn;
496                         $xColumnsL ength[$k]  = $cnt - $ count;   496                         $xColumnsL ength[$k]  = $cnt - $ count;
497                         $k++; $col umn = arra y(); $cnt  = $count;   497                         $k++; $col umn = arra y(); $cnt  = $count;
498                    }   498                    }
499                    $col umn = arra y_merge($c olumn, $ta rget[$key] );   499                    $col umn = arra y_merge($c olumn, $ta rget[$key] );
500                }   500                }
501                $xColumn s[$k] = $c olumn;   501                $xColumn s[$k] = $c olumn;
502                $xColumn sLength[$k ] = $cnt -  $count;   502                $xColumn sLength[$k ] = $cnt -  $count;
503                // --- 3 . integrat e columns  of one ele ment ---   503                // --- 3 . integrat e columns  of one ele ment ---
504                $target  = $xColumn s; $xColum ns = array (); $nextK ey = -1;   504                $target  = $xColumn s; $xColum ns = array (); $nextK ey = -1;
505                if ($max  > 1 && co unt($targe t) > 1)   505                if ($max  > 1 && co unt($targe t) > 1)
506                {   506                {
507                    fore ach($targe t as $key  => $column )   507                    fore ach($targe t as $key  => $column )
508                    {   508                    {
509                         if ($key = = $nextKey ) continue ;   509                         if ($key = = $nextKey ) continue ;
510                         if ($xColu mnsLength[ $key] == 1 )   510                         if ($xColu mnsLength[ $key] == 1 )
511                         {   511                         {
512                             // ---  merge wit h next col umn ---   512                             // ---  merge wit h next col umn ---
513                             $nextK ey = $key  + 1;   513                             $nextK ey = $key  + 1;
514                             if (is set($targe t[$nextKey ]) && coun t($target[ $nextKey]) )   514                             if (is set($targe t[$nextKey ]) && coun t($target[ $nextKey]) )
515                             {   515                             {
516                                 $x Columns[]  = array_me rge($colum n, $target [$nextKey] );   516                                 $x Columns[]  = array_me rge($colum n, $target [$nextKey] );
517                                 co ntinue;   517                                 co ntinue;
518                             }   518                             }
519                         }   519                         }
520                         $xColumns[ ] = $colum n;   520                         $xColumns[ ] = $colum n;
521                    }   521                    }
522                    $tar get = $xCo lumns;   522                    $tar get = $xCo lumns;
523                }   523                }
524           }   524           }
525           $_ rtl = Mage ::getStore ConfigFlag ('megamenu /general/r tl');   525           $_ rtl = Mage ::getStore ConfigFlag ('megamenu /general/r tl');
526           if  ($_rtl) {   526           if  ($_rtl) {
527                $target  = array_re verse($tar get);   527                $target  = array_re verse($tar get);
528           }   528           }
529           re turn $targ et;   529           re turn $targ et;
530       }   530       }
531     531  
532       privat e function  _countChi ld($childr en, $level , &$count)   532       privat e function  _countChi ld($childr en, $level , &$count)
533       {   533       {
534           fo reach ($ch ildren as  $child)   534           fo reach ($ch ildren as  $child)
535           {   535           {
536                if ($chi ld->getIsA ctive())   536                if ($chi ld->getIsA ctive())
537                {   537                {
538                    $cou nt++; $act iveChildre n = $this- >_getActiv eChildren( $child, $l evel);   538                    $cou nt++; $act iveChildre n = $this- >_getActiv eChildren( $child, $l evel);
539                    if ( count($act iveChildre n) > 0) $t his->_coun tChild($ac tiveChildr en, $level  + 1, $cou nt);   539                    if ( count($act iveChildre n) > 0) $t his->_coun tChild($ac tiveChildr en, $level  + 1, $cou nt);
540                }   540                }
541           }   541           }
542       }   542       }
543          543       
544       //get  static blo cks in men u   544       //get  static blo cks in men u
545       public  function  _getBlocks ($model, $ block_sign al)   545       public  function  _getBlocks ($model, $ block_sign al)
546       {   546       {
547           if  (!$this-> _tplProces sor)   547           if  (!$this-> _tplProces sor)
548           {    548           { 
549                $this->_ tplProcess or = Mage: :helper('c ms')->getB lockTempla teProcesso r();                549                $this->_ tplProcess or = Mage: :helper('c ms')->getB lockTempla teProcesso r();             
550           }   550           }
551           re turn $this ->_tplProc essor->fil ter( trim( $model->ge tData($blo ck_signal) ) );    551           re turn $this ->_tplProc essor->fil ter( trim( $model->ge tData($blo ck_signal) ) ); 
552       }   552       }
553     553  
554       privat e static f unction _e xplodeArra yByColumns Horisontal ($list, $n um, $catNu m)   554       privat e static f unction _e xplodeArra yByColumns Horisontal ($list, $n um, $catNu m)
555       {   555       {
556           if  ($num <=  0) return  array($lis t);   556           if  ($num <=  0) return  array($lis t);
557           $p artition =  array();            557           $p artition =  array();         
558           $p artition =  array_pad ($partitio n, $catNum , array()) ;     558           $p artition =  array_pad ($partitio n, $catNum , array()) ;  
559                     559                  
560           $i  = 0;   560           $i  = 0;
561           fo reach ($li st as $key  => $value ) {   561           fo reach ($li st as $key  => $value ) {
562                $partiti on[$i][$ke y] = $valu e;   562                $partiti on[$i][$ke y] = $valu e;
563                if (++$i  == $catNu m) $i = 0;   563                if (++$i  == $catNu m) $i = 0;
564           }   564           }
565           re turn $part ition;   565           re turn $part ition;
566       }   566       }
567          567       
568       //get  Label for  menu   568       //get  Label for  menu
569       privat e function  _getLabel Html($catM odel, $lev el)   569       privat e function  _getLabel Html($catM odel, $lev el)
570       {   570       {
571           $l abel = $ca tModel->ge tData('sw_ cat_label' );   571           $l abel = $ca tModel->ge tData('sw_ cat_label' );
572           if  ($label)  {   572           if  ($label)  {
573                $labelCo ntent = se lf::$_help er->getCon fig('categ ory_labels /'.$label) ;   573                $labelCo ntent = se lf::$_help er->getCon fig('categ ory_labels /'.$label) ;
574                if ($lab elContent)  {   574                if ($lab elContent)  {
575                    if ( $level = 0 ) {   575                    if ( $level = 0 ) {
576                         return ' < span class ="cat-labe l cat-labe l-'. $labe l .' pin-b ottom">' .  $labelCon tent . '</ span>';   576                         return ' < span class ="cat-labe l cat-labe l-'. $labe l .' pin-b ottom">' .  $labelCon tent . '</ span>';
577                    } el se {   577                    } el se {
578                         return ' < span class ="cat-labe l cat-labe l-'. $labe l .'">' .  $labelCont ent . '</s pan>';   578                         return ' < span class ="cat-labe l cat-labe l-'. $labe l .'">' .  $labelCont ent . '</s pan>';
579                    }   579                    }
580                }   580                }
581           }   581           }
582           re turn '';   582           re turn '';
583       }   583       }
584          584       
585       /**   585       /**
586        * Che ck if curr ent url is  url for h ome page   586        * Che ck if curr ent url is  url for h ome page
587        *   587        *
588        * @re turn true   588        * @re turn true
589        */   589        */
590       public  function  getIsHomeP age()   590       public  function  getIsHomeP age()
591       {   591       {
592           if (Mage::app ()->getFro ntControll er()->getR equest()-> getActionN ame()=='in dex' && Ma ge::app()- >getFrontC ontroller( )->getRequ est()->get RouteName( )=='cms' & & Mage::ap p()->getFr ontControl ler()->get Request()- >getContro llerName() =='index')   592           if (Mage::app ()->getFro ntControll er()->getR equest()-> getActionN ame()=='in dex' && Ma ge::app()- >getFrontC ontroller( )->getRequ est()->get RouteName( )=='cms' & & Mage::ap p()->getFr ontControl ler()->get Request()- >getContro llerName() =='index')
593                return t rue;   593                return t rue;
594           re turn false ;   594           re turn false ;
595       }   595       }
596     596  
597       public  function  getLogoSrc ()   597       public  function  getLogoSrc ()
598       {   598       {
599           if  (empty($t his->_data ['logo_src '])) {   599           if  (empty($t his->_data ['logo_src '])) {
600                $this->_ data['logo _src'] = M age::getSt oreConfig( 'design/he ader/logo_ src');   600                $this->_ data['logo _src'] = M age::getSt oreConfig( 'design/he ader/logo_ src');
601           }   601           }
602           re turn $this ->getSkinU rl($this-> _data['log o_src']);   602           re turn $this ->getSkinU rl($this-> _data['log o_src']);
603       }   603       }
604     604  
605       public  function  getLogoAlt ()   605       public  function  getLogoAlt ()
606       {   606       {
607           if  (empty($t his->_data ['logo_alt '])) {   607           if  (empty($t his->_data ['logo_alt '])) {
608                $this->_ data['logo _alt'] = M age::getSt oreConfig( 'design/he ader/logo_ alt');   608                $this->_ data['logo _alt'] = M age::getSt oreConfig( 'design/he ader/logo_ alt');
609           }   609           }
610           re turn $this ->_data['l ogo_alt'];   610           re turn $this ->_data['l ogo_alt'];
611       }   611       }
612   }   612   }