SHARE
TWEET

Untitled

a guest Oct 23rd, 2015 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.   $Id$ explode_category_tree
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.   Copyright (c) 2010 osCommerce
  8.  
  9.   extended class author: G.L. Walker
  10.   Copyright (c) 2014 G.L. Walker
  11.  
  12.   Released under the GNU General Public License
  13. */
  14.   class explode_category_tree extends category_tree {
  15.    
  16.     var $parent_group_start_string = null,
  17.             $parent_group_end_string = null,
  18.                 $parent_group_apply_to_root = false,
  19.                 $root_start_string = '<li class="dropdown">',
  20.                 $root_end_string = '</li>',
  21.                 $parent_start_string = '<ul class="dropdown-menu">',
  22.                 $parent_end_string = '</ul>',
  23.                 $child_start_string = '<li>',
  24.                 $child_end_string = '</li>';
  25.                
  26.     function _buildHoz($parent_id, $level = 0) {
  27.       if(isset($this->_data[$parent_id])) {
  28.         foreach($this->_data[$parent_id] as $category_id => $category) {
  29.           if($this->breadcrumb_usage === true) {
  30.             $category_link = $this->buildBreadcrumb($category_id);
  31.           } else {
  32.             $category_link = $category_id;
  33.           }
  34.           if(($this->follow_cpath === true) && in_array($category_id, $this->cpath_array)) {
  35.             $link_title = $this->cpath_start_string . $category['name'] . $this->cpath_end_string;
  36.           } else {
  37.             $link_title = $category['name'];
  38.           }
  39.  
  40.                   if (isset($this->_data[$category_id]) && ($level != 0)) {
  41.             $result .= '<li class="dropdown dropdown-submenu"><a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">';
  42.             $caret = '<span class="tsimi"></span>';
  43.           } elseif(isset($this->_data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level + 1))) {
  44.             $result .= $this->root_start_string;
  45.             $result .= '<a href="#" tabindex="-1" class="dropdown-toggle" data-toggle="dropdown">';
  46.             $caret =   ' <span class="fa fa-caret-down"></span>';
  47.                                
  48.           } else {
  49.             $result .= $this->child_start_string;
  50.             $result .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
  51.             $caret = false;
  52.           }
  53.                  
  54.           $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level);
  55.           $result .= $link_title . (($caret != false) ? $caret : null) . '</a>';
  56.  
  57.                  
  58.           if(isset($this->_data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level + 1))) {
  59.             // show parent category link //
  60.                     if (MODULE_CONTENT_HEADER_CATMENU_PARENT_LINK == 'True') {
  61.                         $root_link_title =  '<span"><span class="fa fa-list"></span>&nbsp;' . $link_title . '</span>';
  62.                         }
  63.                         // divider added for clarity //
  64.                         if (MODULE_CONTENT_HEADER_CATMENU_DEVIDER == 'True') {
  65.                         $root_link_title .= '<li class="visible-xs divider"></li>';
  66.                         }
  67.                        
  68.             $result .= $this->parent_start_string;
  69.             $result .= '<li><a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '"><strong>' . $root_link_title . '</strong></a></li>';
  70.             $result .= $this->_buildHoz($category_id, $level + 1);
  71.             $result .= $this->parent_end_string;
  72.             $result .= $this->child_end_string;
  73.           } else {
  74.             $result .= $this->root_end_string;
  75.           }
  76.         }
  77.       }
  78.       return $result;
  79.     }
  80.     function getExTree() {
  81.       return $this->_buildHoz($this->root_category_id);
  82.     }
  83.   }
  84. /* end explode_category_tree */
  85. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top