<?php $category_list = getStyledCategoryList(); ?> <ul> <?php echo $category_list; ?> </ul>
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; }
<span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="<?php echo www; ?> "> <img src="$templatedir$/images/logo.png" height="30"> </a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <?php $parent_list = abo_get_navigation(0, 0, true); $categories = getStyledCategoryList(0, 0, true); xD3bug($parent_list); xD3bug($categories, 1, '127.0.0.1'); if ($categories) { $_cat = array(); foreach ($categories as $category) { $category['kids'] = null; $_cat[] = $category; } $parent_list[] = array('link' => '#', 'title' => Translate('Products') . ' - ' . STORE_NAME, 'name' => Translate('Products'), 'kids' => $_cat); } function createDropDown($array, $level = 0) { $_return = ''; foreach ($array as $elem) { if (!empty($elem['kids'])) {