private function get_subcategories($parent_id)
 {
     if (tep_has_category_subcategories($parent_id)) {
         global $languages_id;
         $categories_data = array();
         // Retrieve the data on the subcategories
         $categories_query_raw = "\n\t\t\t\tselect\n\t\t\t\t  c.categories_id,\n\t\t\t\t  c.parent_id,\n\t\t\t\t  cd.categories_name\n\t\t\t\tfrom " . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\t\t\t  join " . TABLE_CATEGORIES . " c\n\t\t\t\t\ton (c.categories_id = cd.categories_id)\n\t\t\t\twhere\n\t\t\t\t  c.parent_id = '" . (int) $parent_id . "'\n\t\t\t\t  and cd.language_id = '" . (int) $languages_id . "'\n\t\t\t\torder by\n\t\t\t\t  c.sort_order,\n\t\t\t\t  cd.categories_name\n\t\t\t  ";
         //print 'Categories Query: ' . $categories_query_raw . '<br />';
         $categories_query = tep_db_query($categories_query_raw);
         // Load the subcategory data into an array
         $index = 0;
         while ($categories = tep_db_fetch_array($categories_query)) {
             $categories_id = (int) $categories['categories_id'];
             $path_string = $this->get_category_path($categories_id);
             if ($categories_id != 0) {
                 $categories_data[$index] = array('id' => $categories_id, 'name' => $categories['categories_name'], 'parent_id' => $categories['parent_id'], 'path' => $path_string);
                 // If the category has subcats, add them to the array
                 if (tep_has_category_subcategories($categories_id)) {
                     $categories_data[$index]['subcat'] = $this->get_subcategories($categories_id);
                 } else {
                     $categories_data[$index]['subcat'] = false;
                 }
             }
             // if( $categories_id
             $index++;
         }
         //while ($categories
         return $categories_data;
     } else {
         return false;
     }
 }
 function buildCategories($parent_id)
 {
     global $languages_id;
     $result = '';
     $categories_query = tep_db_query("SELECT c.categories_id, cd.categories_name, c.parent_id FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND cd.language_id = '" . (int) $languages_id . "' AND c.parent_id = '" . $parent_id . "' ORDER BY c.sort_order, cd.categories_name");
     $colcount = tep_db_num_rows($categories_query);
     if ($colcount > 0) {
         if ($colcount > 4) {
             $colcount = 4;
         }
         $result .= '<ul id="products_sitemap" class="col' . $colcount . '">';
         $count = 0;
         while ($categories = tep_db_fetch_array($categories_query)) {
             if ($count == 0) {
                 $result .= '<li class="first">';
             } else {
                 $result .= '<li>';
             }
             $result .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $categories['categories_id']) . '" title="' . $categories['categories_name'] . ' - ' . STORE_NAME . '" class="sitemap">' . $categories['categories_name'] . '</a>';
             if (tep_has_category_subcategories($categories['categories_id'])) {
                 $result .= $this->buildCategories($categories['categories_id']);
             } else {
                 if (tep_count_products_in_category($categories['categories_id']) > 0) {
                     //$result .= $this->buildProducts($categories['categories_id']);
                 }
             }
             $result .= '</li>';
             $count++;
         }
         $result .= '</ul>';
     }
     return $result;
 }
Example #3
0
function tep_show_categoryxc($cid, $cpath, $display_empty)
{
    global $categoriesxc_string, $languages_id, $_GET;
    global $level;
    $selectedPath = array();
    // Get all of the categories on this level
    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = " . $cid . " and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id . "' order by sort_order, cd.categories_name");
    while ($categories = tep_db_fetch_array($categories_query)) {
        if ($level[$categories['parent_id']] == "") {
            $level[$categories['parent_id']] = 0;
        }
        $level[$categories['categories_id']] = $level[$categories['parent_id']] + 1;
        // Add category link to $categoriesxc_string
        $products_in_category = tep_count_products_in_category($categories['categories_id']);
        if ($display_empty == 0 && $products_in_category < 1) {
            $display_category = false;
        } else {
            $display_category = true;
        }
        if ($display_category == true) {
            $categoriesxc_string .= "\t<li><a href=\"";
            $cPath_new = $cpath;
            if ($level[$categories['parent_id']] > 0) {
                $cPath_new .= "_";
            }
            $cPath_new .= $categories['categories_id'];
            $cPath_new_text = "cPath=" . $cPath_new;
            $categoriesxc_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text);
            $categoriesxc_string .= '" title="' . $categories['categories_name'] . '">';
            if ($_GET['cPath']) {
                $selectedPath = split("_", $_GET['cPath']);
            }
            //if (in_array($categories['categories_id'], $selectedPath)) { $categoriesxc_string .= '<strong>'; }
            $categoriesxc_string .= $categories['categories_name'];
            //if (in_array($categories['categories_id'], $selectedPath)) { $categoriesxc_string .= '</strong>'; }
            $categoriesxc_string .= '</a>';
            if (SHOW_COUNTS) {
                if ($products_in_category > 0) {
                    $categoriesxc_string .= '&nbsp;(' . $products_in_category . ')';
                }
            }
            // If I have subcategories, get them and show them
            if (tep_has_category_subcategories($categories['categories_id'])) {
                $categoriesxc_string .= "<ul id=\"catid" . $categories['categories_id'] . "\" title=\"" . $categories['categories_name'] . "\">\n";
                tep_show_categoryxc($categories['categories_id'], $cPath_new, $display_empty);
                $categoriesxc_string .= "</ul>\n";
            }
            $categoriesxc_string .= "</li>\n";
        }
    }
}
Example #4
0
/**
 * $Id: categories.php 57 2005-12-15 14:39:09Z Michael $

 * osCommerce, Open Source E-Commerce Solutions
 * http://www.oscommerce.com

 * Copyright (c) 2003 osCommerce

 * Released under the GNU General Public License

 * adapted 2005 for xoops 2.0.x by FlinkUX e.K. <http://www.flinkux.de>
  
 * (c) 2005  Michael Hammelmann <*****@*****.**>
 * @package xosC
 * @author Michael Hammelmann <*****@*****.**>
 * @version 1
**/
function tep_show_category($tmp_counter, $cat_string, $tmp_tree, $cPath_array)
{
    $tree = $tmp_tree;
    $counter = $tmp_counter;
    $categories_string = "";
    for ($i = 0; $i < $tree[$counter]['level']; $i++) {
        $categories_string .= "&nbsp;&nbsp;";
    }
    $categories_string .= '<a href="';
    if ($tree[$counter]['parent'] == 0) {
        $cPath_new = 'cPath=' . $counter;
    } else {
        $cPath_new = 'cPath=' . $tree[$counter]['path'];
    }
    $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
        $categories_string .= '<b>';
    }
    // display category name
    $categories_string .= $tree[$counter]['name'];
    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
        $categories_string .= '</b>';
    }
    if (tep_has_category_subcategories($counter)) {
        $categories_string .= '-&gt;';
    }
    $categories_string .= '</a>';
    if (SHOW_COUNTS == 'true') {
        $products_in_category = tep_count_products_in_category($counter);
        if ($products_in_category > 0) {
            $categories_string .= '&nbsp;(' . $products_in_category . ')';
        }
    }
    $categories_string .= '<br>';
    if ($tree[$counter]['next_id'] != false) {
        // $categories_string.="tep_show_category(".$tree[$counter]['next_id'].",".$categories_string.",".$tree.",".$cPath_array.")";
        $categories_string .= tep_show_category($tree[$counter]['next_id'], $categories_string, $tree, $cPath_array);
    }
    return $categories_string;
}
Example #5
0
function tep_show_category($counter)
{
    global $tree, $categories_string, $cPath_array;
    for ($i = 0; $i < $tree[$counter]['level']; $i++) {
        $categories_string .= "&nbsp;&nbsp;";
    }
    $categories_string .= '<a href="';
    if ($tree[$counter]['parent'] == 0) {
        $cPath_new = 'cPath=' . $counter;
    } else {
        $cPath_new = 'cPath=' . $tree[$counter]['path'];
    }
    $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
        $categories_string .= '<b>';
    }
    // display category name
    $categories_string .= $tree[$counter]['name'];
    if (isset($cPath_array) && in_array($counter, $cPath_array)) {
        $categories_string .= '</b>';
    }
    if (tep_has_category_subcategories($counter)) {
        $categories_string .= '';
    }
    $categories_string .= '</a>';
    if (SHOW_COUNTS == 'false') {
        $products_in_category = tep_count_products_in_category($counter);
        if ($products_in_category > 0) {
            $categories_string .= '&nbsp;(' . $products_in_category . ')';
        }
    }
    $categories_string .= '<br>';
    if ($tree[$counter]['next_id'] != false) {
        tep_show_category($tree[$counter]['next_id']);
    }
}
Example #6
0
<?php

if (PRODUCT_COMPARE == 'true') {
    $current_category = '';
    if ($_GET['cPath']) {
        $current_category = end(explode('_', $_GET['cPath']));
    } elseif (strstr($_SERVER['PHP_SELF'], FILENAME_PRODUCT_INFO)) {
        $categories_query = tep_db_query("select categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $_GET['products_id'] . "'");
        $categories = tep_db_fetch_array($categories_query);
        $current_category = $categories['categories_id'];
    }
    ?>
    <?php 
    if ($current_category && tep_has_category_subcategories($current_category) == 0) {
        ?>
    <div class="box compare">
        <div class="box_title">
             <?php 
        echo Translate('Producten vergelijken');
        ?>
        </div>
        <div class="box_content">
            <ul id="compare_list">
                <?php 
        $compare_count = 0;
        $compare_category = $current_category;
        if ($_COOKIE['compare_' . $compare_category]) {
            $cookie_val = $_COOKIE['compare_' . $compare_category];
            foreach (explode('_', $cookie_val) as $products_id) {
                if ($products_id != '') {
                    $compare_count++;
Example #7
0
function tep_make_cat_ulbranch($parcat, $table, $level, $maxlevel)
{
    global $cPath_array, $classname_for_selected, $classname_for_parent;
    $list = $table[$parcat];
    while (list($key, $val) = each($list)) {
        if ($GLOBALS['this_level'] != $level) {
            if ($GLOBALS['this_level'] < $level) {
                $output .= "\n" . '<ul>';
            } else {
                for ($nest = 1; $nest <= $GLOBALS['this_level'] - $level; $nest++) {
                    $output .= '</ul></li>' . "\n";
                }
                /*							
                							if ($GLOBALS['this_level'] -1 == $level)
                $output .= '</ul></li>'."\n";
                elseif ($GLOBALS['this_level'] -2 == $level)
                $output .= '</ul></li></ul></li>'."\n";
                elseif ($GLOBALS['this_level'] -3 == $level)
                $output .= '</ul></li></ul></li></ul></li>'."\n";
                elseif ($GLOBALS['this_level'] -4 == $level)
                $output .= '</ul></li></ul></li></ul></li></ul></li>'."\n"; 
                */
            }
            $GLOBALS['this_level'] = $level;
        }
        if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) {
            $this_cat_class = ' class="' . $classname_for_selected . '"';
        } else {
            $this_cat_class = '';
        }
        $output .= '<li' . $this_cat_class . '><a href="';
        if (!$level) {
            unset($GLOBALS['cPath_set']);
            $GLOBALS['cPath_set'][0] = $key;
            $cPath_new = 'cPath=' . $key;
        } else {
            $GLOBALS['cPath_set'][$level] = $key;
            $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, $level + 1));
        }
        if (tep_has_category_subcategories($key) && $classname_for_parent) {
            $this_parent_class = ' class="' . $classname_for_parent . '"';
        } else {
            $this_parent_class = '';
        }
        $output .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"' . $this_parent_class . '>' . $val;
        if (SHOW_COUNTS == 'true') {
            $products_in_category = tep_count_products_in_category($key);
            if ($products_in_category > 0) {
                $output .= '&nbsp;(' . $products_in_category . ')';
            }
        }
        $output .= '</a>';
        if (!tep_has_category_subcategories($key)) {
            $output .= '</li>' . "\n";
        }
        if (isset($table[$key]) and ($maxlevel > $level + 1 or $maxlevel == '0')) {
            $output .= tep_make_cat_ulbranch($key, $table, $level + 1, $maxlevel);
        }
    }
    // End while loop
    return $output;
}
Example #8
0
function tep_get_category_level($parent_id = 0, $level = 0, $products_types_id = '1', $opened_categories = array(), $in_form = true)
{
    global $languages_id;
    $parent_categories = array();
    if (sizeof($opened_categories) > 0) {
        reset($opened_categories);
        while (list(, $opened_category_id) = each($opened_categories)) {
            $parent_categories[] = $opened_category_id;
            tep_get_parents($parent_categories, $opened_category_id);
        }
    }
    $categories_string = '';
    $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.products_types_id = '" . (int) $products_types_id . "' and c.parent_id = '" . (int) $parent_id . "'" . (!$in_form ? " and c.categories_id in ('" . implode("', '", $parent_categories) . "')" : "") . " and c.categories_id = cd.categories_id and cd.language_id = '" . (int) DEFAULT_LANGUAGE_ID . "' and c.categories_status = '1' order by c.sort_order, cd.categories_name");
    if (tep_db_num_rows($categories_query) > 0) {
        while ($categories = tep_db_fetch_array($categories_query)) {
            for ($i = 0; $i < $level; $i++) {
                $categories_string .= tep_draw_separator('pixel_trans.gif', 20, 1);
            }
            $show_sublevel = false;
            if (sizeof($opened_categories) > 0) {
                $subcategories = array();
                tep_get_subcategories($subcategories, $categories['categories_id']);
                reset($subcategories);
                while (list(, $subcategory_id) = each($subcategories)) {
                    if (in_array($subcategory_id, $opened_categories)) {
                        $show_sublevel = true;
                        break;
                    }
                }
            }
            if (!$in_form) {
                $categories_string .= '';
            } elseif (tep_has_category_subcategories($categories['categories_id'])) {
                $categories_string .= '<a href="#" id="wlh' . $categories['categories_id'] . '" onclick="loadLevel(\'' . tep_href_link(FILENAME_LOADER, 'action=load_category_level&parent=' . $categories['categories_id'] . '&level=' . ($level + 1), 'SSL') . '\', \'' . $categories['categories_id'] . '\', \'' . ($level + 1) . '\'); return false;" style="text-decoration: none; display: inline-block; width: 15px; text-align: center; font-size: 14px; height: 12px; vertical-align: top; padding-top: 2px;">&nbsp;' . ($show_sublevel ? '&ndash;' : '+') . '&nbsp;</a>';
            } else {
                $categories_string .= tep_draw_separator('pixel_trans.gif', 15, 1);
            }
            if ($in_form) {
                $categories_string .= tep_draw_checkbox_field('categories_' . $parent_id . '_' . $categories['categories_id'], $categories['categories_id'], in_array($categories['categories_id'], $opened_categories) ? true : false, 'id="wlc' . $categories['categories_id'] . '" onclick="checkChilds(\'' . $categories['categories_id'] . '\'); if (this.checked==false && document.getElementById(\'wlc' . $parent_id . '\')) document.getElementById(\'wlc' . $parent_id . '\').checked = false;"');
                $categories_string .= '<label for="wlc' . $categories['categories_id'] . '">' . $categories['categories_name'] . '</label><br />' . "\n";
            } else {
                if (in_array($categories['categories_id'], $opened_categories)) {
                    $categories_string .= '<strong>' . $categories['categories_name'] . '</strong><br />' . "\n";
                } else {
                    $categories_string .= $categories['categories_name'] . '<br />' . "\n";
                }
            }
            if ($show_sublevel) {
                $categories_string .= '		<div id="wls' . $categories['categories_id'] . '" style="padding: 0; margin: 0; display: block;">' . tep_get_category_level($categories['categories_id'], $level + 1, $products_types_id, $opened_categories, $in_form) . '</div>' . "\n";
            } else {
                $categories_string .= '		<div id="wls' . $categories['categories_id'] . '" style="padding: 0; margin: 0; display: none;"></div>' . "\n";
            }
        }
    }
    return $categories_string;
}
Example #9
0
function getStyledCategoryList($parent_id = 0, $level = 0, $return = false)
{
    global $languages_id;
    $output = '';
    if ($return) {
        $output = array();
    }
    $query = "SELECT c.categories_id, c.sort_order, cd.categories_name FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND c.parent_id = '" . $parent_id . "' AND cd.language_id = '" . (int) $languages_id . "' ORDER BY c.sort_order ASC";
    $resource = tep_db_query($query);
    while ($category = tep_db_fetch_array($resource)) {
        if ($category['categories_name'] == '' || $category['categories_name'] == ' ') {
            // Language fallback.
            $fallbackQuery = "SELECT categories_name FROM categories_description WHERE categories_id = " . $category['categories_id'] . " AND language_id = 1";
            $fallbackResource = tep_db_query($fallbackQuery);
            $fallback = tep_db_fetch_array($fallbackResource);
            $category['categories_name'] = $fallback['categories_name'];
        }
        // Make a difference between top-level category and sub-category.
        $class = $level == 0 ? "category" : "sub-category level_" . $level;
        if ($return) {
            $output[] = array('link' => tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category['categories_id']), 'title' => $category['categories_name'] . ' - ' . STORE_NAME, 'name' => $category['categories_name'], 'kids' => tep_has_category_subcategories($category['categories_id']) ? getStyledCategoryList($category['categories_id'], $level + 1, true) : null);
        } else {
            $output .= '<li class="' . $class . '">';
            $output .= '<a class="category_title" href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $category['categories_id']) . '" title="' . $category['categories_name'] . ' - ' . STORE_NAME . '">';
            $output .= $category['categories_name'];
            $output .= '</a>';
            if (tep_has_category_subcategories($category['categories_id'])) {
                $catlevel = $level + 1;
                $class = $level == 0 ? "category level_" . $catlevel : "sub-category level_" . $catlevel;
                $output .= '<ul class="' . $class . '">';
                $output .= getStyledCategoryList($category['categories_id'], $catlevel);
                $output .= '</ul>';
            }
            $output .= '</li>';
        }
    }
    return $output;
}
Example #10
0
function build_menus($currentParID, $menustr, $catstr, $indent)
{
    global $categories_string, $id, $languages_id;
    $tmpCount;
    $tmpCount = 0;
    $haschildren = 0;
    //default
    $categories_query_catmenu = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $currentParID . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id . "' and c.categories_id!=21 and c.categories_id!=23 order by sort_order, cd.categories_name");
    $numberOfRows = tep_db_num_rows($categories_query_catmenu);
    $currentRow = 0;
    while ($categories = tep_db_fetch_array($categories_query_catmenu)) {
        $currentRow++;
        $catName = $categories['categories_name'];
        $tmpCount += 1;
        $haschildren = tep_has_category_subcategories($categories['categories_id']);
        if (SHOW_COUNTS == 'true') {
            $products_in_category = tep_count_products_in_category($categories['categories_id']);
            if ($products_in_category > 0) {
                $catName .= ' (' . $products_in_category . ')';
            }
        }
        if ($catstr != '') {
            $cPath_new = 'cPath=' . $catstr . '_' . $categories['categories_id'];
        } else {
            $indent = 0;
            $cPath_new = 'cPath=' . $categories['categories_id'];
        }
        if ($menustr != '') {
            $menu_tmp = $menustr . '_' . $tmpCount;
        } else {
            $menu_tmp = $tmpCount;
        }
        $indentStr = "";
        for ($i = 0; $i < $indent; $i++) {
            $indentStr .= "   ";
        }
        $categories_string .= $indentStr . "[null, '" . $catName . "','" . tep_href_link(FILENAME_DEFAULT, $cPath_new) . "','_self','" . $tmpString . "'";
        if ($haschildren) {
            $indent += 1;
            $categories_string .= ",\n";
            if ($menustr != '') {
                $menu_tmp = $menustr . '_' . $tmpCount;
            } else {
                $menu_tmp = $tmpCount;
            }
            if ($catstr != '') {
                $cat_tmp = $catstr . '_' . $categories['categories_id'];
            } else {
                $cat_tmp = $categories['categories_id'];
            }
            $NumChildren = build_menus($categories['categories_id'], $menu_tmp, $cat_tmp, $indent);
            if ($currentRow < $numberOfRows) {
                $categories_string .= $indentStr . "],\n";
            } else {
                $categories_string .= $indentStr . "]\n";
            }
        } else {
            if ($currentRow < $numberOfRows) {
                $categories_string .= "],\n";
            } else {
                $categories_string .= "]\n";
            }
            $NumChildren = 0;
        }
    }
    return $tmpCount;
}
function tep_show_category3($cid, $cpath, $COLLAPSABLE, $level = 0)
{
    global $categories_string3, $languages_id, $categories;
    $selectedPath = array();
    // Get all of the categories on this level
    $level++;
    $customer_group_array = array();
    if (!isset($_SESSION['sppc_customer_group_id'])) {
        $customer_group_array[] = 'G';
    } else {
        $customer_group_array = tep_get_customers_access_group($_SESSION['customer_id']);
    }
    $categories_query_raw = "SELECT c.categories_id, cd.categories_name, c.parent_id\r\n                             from " . TABLE_CATEGORIES . " c,\r\n                                  " . TABLE_CATEGORIES_DESCRIPTION . " cd\r\n                           WHERE c.parent_id = '" . $cid . "'\r\n                             and c.categories_id = cd.categories_id\r\n                             and cd.language_id='" . $languages_id . "'";
    $categories_query_raw .= tep_get_access_sql('c.products_group_access', $customer_group_array);
    $categories_query_raw .= " ORDER BY sort_order, cd.categories_name";
    $categories_query = tep_db_query($categories_query_raw);
    while ($categories = tep_db_fetch_array($categories_query)) {
        if (!isset($categories[$level]['parent_id']) || $categories[$level]['parent_id'] == "") {
            $categories[$level]['parent_id'] = 0;
        }
        $categories[$level]['categories_id'] = $categories[$level]['parent_id'] + 1;
        // Add category link to $categories_string3
        for ($a = 1; $a < $level; $a++) {
            $categories_string3 .= "&nbsp;&nbsp;";
        }
        $categories_string3 .= '<a href="';
        $cPath_new = $cpath;
        // if ($categories[$level]['parent_id'] > 0) {
        if ($categories['parent_id'] > 0) {
            $cPath_new .= "_";
        }
        $cPath_new .= $categories['categories_id'];
        // added for CDS CDpath support
        $CDpath = isset($_SESSION['CDpath']) ? '&CDpath=' . $_SESSION['CDpath'] : '';
        $cPath_new_text = "cPath=" . $cPath_new . $CDpath;
        $categories_string3 .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text);
        $categories_string3 .= '">';
        if ($_GET['cPath']) {
            $selectedPath = explode("_", $_GET['cPath']);
        }
        if (in_array($categories['categories_id'], $selectedPath)) {
            $categories_string3 .= '<b>';
        }
        if ($categories[$level]['categories_id'] == 1) {
            $categories_string3 .= '<u>';
        }
        $categories_string3 .= tep_db_decoder($categories['categories_name']);
        if ($COLLAPSABLE && tep_has_category_subcategories($categories['categories_id'])) {
            $categories_string3 .= ' ->';
        }
        if ($categories[$level]['categories_id'] == 1) {
            $categories_string3 .= '</u>';
        }
        if (in_array($categories['categories_id'], $selectedPath)) {
            $categories_string3 .= '</b>';
        }
        $categories_string3 .= '</a>';
        if (SHOW_COUNTS) {
            $products_in_category = tep_count_products_in_category($categories['categories_id']);
            if ($products_in_category > 0) {
                $categories_string3 .= '&nbsp;(' . $products_in_category . ')';
            }
        }
        $categories_string3 .= '<br>';
        // If I have subcategories, get them and show them
        if (tep_has_category_subcategories($categories['categories_id'])) {
            if ($COLLAPSABLE) {
                if (in_array($categories['categories_id'], $selectedPath)) {
                    tep_show_category3($categories['categories_id'], $cPath_new, $COLLAPSABLE, $level);
                }
            } else {
                tep_show_category3($categories['categories_id'], $cPath_new, $COLLAPSABLE, $level);
            }
        }
    }
}
Example #12
0
 function tep_show_category($counter)
 {
     $boxContent = '';
     $catlevel = '0';
     $boxContent .= '<table border="0" cellpadding="0" cellspacing="0" width="100%">';
     // BoF - Contribution Category Box Enhancement 1.1
     global $tree, $boxContent, $cPath_array, $cat_name, $customer_group_id, $box_width;
     $cPath_new = 'cPath=' . $tree[$counter]['path'];
     $boxContent .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr';
     for ($i = 0; $i < $tree[$counter]['level']; $i++) {
         $catlevel .= $i;
     }
     $boxContent .= ' class="level' . $catlevel . '">';
     // Add control for detecting last item in menu
     if ($tree[$counter]['next_id'] != false) {
         $boxContent .= '<td width="' . $box_width . '" class="menuItem">';
     } else {
         $boxContent .= '<td width="' . $box_width . '" class="menuItemLast">';
     }
     for ($i = 0; $i < $tree[$counter]['level']; $i++) {
         $boxContent .= "&nbsp;&nbsp;";
     }
     $boxContent .= '<a class="' . $catlevel . 'level" href="';
     $boxContent .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
     if (tep_has_category_subcategories($counter)) {
         $boxContent .= tep_image(DIR_WS_ICONS . 'pointer_blue.gif', '');
     } else {
         $boxContent .= tep_image(DIR_WS_ICONS . 'pointer_blue_light.gif', '');
     }
     // highlights the active chain
     if (isset($cPath_array) && in_array($counter, $cPath_array)) {
         $boxContent .= '<b>';
     }
     if ($cat_name == $tree[$counter]['name']) {
         $boxContent .= '<span class="selectedCat">';
     }
     // highlights the active category name when it is selected
     $boxContent .= $tree[$counter]['name'];
     if (SHOW_COUNTS == 'true') {
         $products_in_category = tep_count_products_in_category($counter);
         if ($products_in_category > 0) {
             $boxContent .= '&nbsp;(' . $products_in_category . ')';
         }
     }
     if ($cat_name == $tree[$counter]['name']) {
         $boxContent .= '</span>';
     }
     if (isset($cPath_array) && in_array($counter, $cPath_array)) {
         $boxContent .= '</b>';
     }
     //         EoF Category Box Enhancement
     $boxContent .= '</a></td>';
     /////////////ADD IN PLUS SIGN ////////////////////////
     if (tep_has_category_subcategories($counter)) {
         if ($tree[$counter]['next_id'] != false) {
             $boxContent .= '<td width="10" class="menuItem"><a class="' . $catlevel . 'level" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_ICONS . 'plus.gif', '') . '</a></td>';
         } else {
             $boxContent .= '<td width="10" class="menuItemLast"><a class="' . $catlevel . 'level" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_ICONS . 'plus.gif', '') . '</a></td>';
         }
     }
     //////////////////////////////////////////////////////
     $boxContent .= '</tr></table>';
     //    $boxContent .= '<br>';
     if ($tree[$counter]['next_id'] != false) {
         tep_show_category($tree[$counter]['next_id']);
     }
 }