$where = substr($where, 0, strlen($where) - 1); $where .= '&'; } $where .= 'categories_id[' . $level . ']=' . $category['categories_id']; // get all cats to generate multilevel fake url eof if ($category['categories_external_url']) { $link = $category['categories_external_url']; } else { $link = mslib_fe::typolink($this->conf['products_listing_page_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); } $name = '<a href="' . $link . '" class="ajax_link">' . $category['categories_name'] . '</a>'; $html = '<div class="main_category_box">' . "\n" . ' <h2>' . $name . '</h2>' . "\n" . '</div>'; } else { $name = '<span>' . $category['categories_name'] . '</span>'; $subcats_html = mslib_fe::get_subcategories_as_ul($category['categories_id']); if ($subcats_html) { $html = '<div class="main_category_box">' . "\n" . ' <h2>' . $name . '</h2>' . "\n"; $html .= $subcats_html . "\n" . ' </div>'; } } if ($html) { $cols[] = $html; } } } $content .= '<div id="menu_category_listing">'; $delimited = ceil(count($cols) / 3); if ($delimited < 1) {
public function get_subcategories_as_ul($parent_id = '0', &$content = '') { if (!is_numeric($parent_id)) { return false; } $str = $GLOBALS['TYPO3_DB']->SELECTquery('c.categories_id, cd.categories_name, c.parent_id', 'tx_multishop_categories c, tx_multishop_categories_description cd', 'c.status=1 and c.parent_id = \'' . $parent_id . '\' and c.page_uid=\'' . $this->showCatalogFromPage . '\' and cd.language_id=\'' . $this->sys_language_uid . '\' and c.categories_id = cd.categories_id', '', 'c.sort_order, cd.categories_name', ''); $categories_query = $GLOBALS['TYPO3_DB']->sql_query($str); $count = $GLOBALS['TYPO3_DB']->sql_num_rows($categories_query); if ($count) { $content .= '<ul>'; while ($categories = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($categories_query)) { if ($categories['categories_name']) { $content .= '<li>'; if (mslib_fe::hasProducts($categories['categories_id'])) { // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($categories['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $item) { $where .= 'categories_id[' . $level . ']=' . $item['id'] . '&'; $level++; } $where = substr($where, 0, strlen($where) - 1); $where .= '&'; } $where .= 'categories_id[' . $level . ']=' . $categories['categories_id']; $link = mslib_fe::typolink($this->conf['products_listing_page_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); // get all cats to generate multilevel fake url eof $name = '<a href="' . $link . '" class="ajax_link">' . $categories['categories_name'] . '</a>'; } else { $name = '<span>' . $categories['categories_name'] . '</span>'; } $content .= $name; mslib_fe::get_subcategories_as_ul($categories['categories_id'], $content); $content .= '</li>'; } } $content .= '</ul>'; } return $content; }