Example #1
0
 public function tep_get_categories_select($categories_id = '0', $aid = '', $level = 0, $selectedid = '')
 {
     $qry = $GLOBALS['TYPO3_DB']->SELECTquery('cd.categories_name, c.categories_id, c.parent_id', 'tx_multishop_categories c, tx_multishop_categories_description cd', 'c.parent_id=\'' . $categories_id . '\' and c.status=1 and c.categories_id=cd.categories_id and c.page_uid=\'' . $this->shop_pid . '\'', '', 'c.sort_order, cd.categories_name', '');
     $parent_categories_query = $GLOBALS['TYPO3_DB']->sql_query($qry);
     $html = '';
     while (($parent_categories = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($parent_categories_query)) != false) {
         $html .= '<option value="' . $parent_categories['categories_id'] . '" ' . ($selectedid == $parent_categories['categories_id'] ? 'selected' : '') . '>';
         for ($i = 0; $i < $level; $i++) {
             $html .= '--';
         }
         $html .= $parent_categories['categories_name'] . '</option>';
         $strchk = $GLOBALS['TYPO3_DB']->SELECTquery('count(1) as total', 'tx_multishop_categories', 'c.parent_id=\'' . $parent_categories['categories_id'] . '\'', '', '', '');
         $qrychk = $GLOBALS['TYPO3_DB']->sql_query($strchk);
         $rowTotal = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qrychk);
         if ($rowTotal['total']) {
             $html .= mslib_befe::tep_get_categories_select($parent_categories['categories_id'], $aid, $level + 1, $selectedid);
         }
     }
     if (!$categories_id) {
         $html .= '</select>';
     }
     return $html;
 }