function start()
 {
     if (PHP_VERSION < 4.1) {
         global $_GET;
     }
     global $cPath, $cPath_array, $current_category_id;
     if (isset($_GET['cPath'])) {
         $cPath = $_GET['cPath'];
     } elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
         $cPath = tep_get_product_path($_GET['products_id']);
     } else {
         $cPath = '';
     }
     if (!empty($cPath)) {
         $cPath_array = tep_parse_category_path($cPath);
         $cPath = implode('_', $cPath_array);
         $current_category_id = end($cPath_array);
     } else {
         $current_category_id = 0;
     }
     include 'includes/classes/category_tree.php';
     return true;
 }
tep_expire_banners();
// auto expire special products
require 'includes/functions/specials.php';
tep_expire_specials();
require 'includes/classes/osc_template.php';
$oscTemplate = new oscTemplate();
// calculate category path
if (isset($_GET['cPath'])) {
    $cPath = $_GET['cPath'];
} elseif (isset($_GET['products_id']) && !isset($_GET['manufacturers_id'])) {
    $cPath = tep_get_product_path($_GET['products_id']);
} else {
    $cPath = '';
}
if (!empty($cPath)) {
    $cPath_array = tep_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = $cPath_array[sizeof($cPath_array) - 1];
} else {
    $current_category_id = 0;
}
// include category tree class
require 'includes/classes/category_tree.php';
// include the breadcrumb class and start the breadcrumb trail
require 'includes/classes/breadcrumb.php';
$breadcrumb = new breadcrumb();
$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
$breadcrumb->add(HEADER_TITLE_CATALOG, OSCOM::link('index.php'));
// add category names or the manufacturer name to the breadcrumb trail
if (isset($cPath_array)) {
    for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
Beispiel #3
0
function show_categories($options)
{
    global $xoopsDB, $xoopsConfig, $xoopsTpl, $xoopsConfig;
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/configure.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/database_tables.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/filenames.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/database.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/sessions.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/general.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/functions/html_output.php";
    include_once XOOPS_ROOT_PATH . "/modules/osC/includes/classes/boxes.php";
    $cPath = '';
    $cPath_array = array();
    $categories_string = "";
    if (!defined('XBLOCK_CONFIG')) {
        $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
        while ($configuration = tep_db_fetch_array($configuration_query)) {
            define($configuration['cfgKey'], $configuration['cfgValue']);
        }
        define('XBLOCK_CONFIG', "1");
    }
    if (!isset($_SESSION['languages_id'])) {
        $lang_query = "select languages_id from " . TABLE_LANGUAGES . " where directory ='" . $xoopsConfig['language'] . "'";
        $lang = tep_db_query($lang_query);
        $lang_id = tep_db_fetch_array($lang);
        $languages_id = $lang_id['languages_id'];
    } else {
        $languages_id = $_SESSION['languages_id'];
    }
    $info_box_contents = array();
    $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
    // $cat_list_head = new infoBoxHeading($info_box_contents, true, false);
    // $categories_string = $cat_list_head->content;
    // $categories_string = '';
    $tree = array();
    $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 = '0' and c.categories_status = 1 and c.categories_id = cd.categories_id and cd.language_id='" . (int) $languages_id . "' order by sort_order, cd.categories_name");
    while ($categories = tep_db_fetch_array($categories_query)) {
        $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false);
        if (isset($parent_id)) {
            $tree[$parent_id]['next_id'] = $categories['categories_id'];
        }
        $parent_id = $categories['categories_id'];
        if (!isset($first_element)) {
            $first_element = $categories['categories_id'];
        }
    }
    $cPath = isset($_GET['cPath']) ? $_GET['cPath'] : '';
    if (tep_not_null($cPath)) {
        $cPath_array = tep_parse_category_path($cPath);
        $cPath = implode('_', $cPath_array);
        $current_category_id = $cPath_array[sizeof($cPath_array) - 1];
    } else {
        $current_category_id = 0;
    }
    //------------------------
    if (tep_not_null($cPath)) {
        $new_path = '';
        reset($cPath_array);
        while (list($key, $value) = each($cPath_array)) {
            unset($parent_id);
            unset($first_id);
            $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 = '" . (int) $value . "' and c.categories_status = 1 and c.categories_id = cd.categories_id and cd.language_id='" . (int) $languages_id . "' order by sort_order, cd.categories_name");
            if (tep_db_num_rows($categories_query)) {
                $new_path .= $value;
                while ($row = tep_db_fetch_array($categories_query)) {
                    $tree[$row['categories_id']] = array('name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key + 1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false);
                    if (isset($parent_id)) {
                        $tree[$parent_id]['next_id'] = $row['categories_id'];
                    }
                    $parent_id = $row['categories_id'];
                    if (!isset($first_id)) {
                        $first_id = $row['categories_id'];
                    }
                    $last_id = $row['categories_id'];
                }
                $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
                $tree[$value]['next_id'] = $first_id;
                $new_path .= '_';
            } else {
                break;
            }
        }
    }
    $categories_string = tep_show_category($first_element, $categories_string, $tree, $cPath_array);
    $info_box_contents = array();
    $info_box_contents[] = array('text' => $categories_string);
    $cat_list = new infoBox($info_box_contents);
    // print_r($tree);
    //  $xoopsTpl->assign("cat_list",$cat_list->content);
    return $cat_list->content;
}