function makeMenuArray() { $cats = mslib_fe::getSubcatsOnly($this->categoriesStartingPoint, 0, $this->conf['catalog_shop_pid'], 0); $menuArr = array(); $tel = 0; foreach ($cats as $cat) { $menuArr[$tel]['title'] = $cat['categories_name']; $menuArr[$tel]['uid'] = '9999' . $cat['categories_id']; $menuArr[$tel]['description'] = $cat['meta_description']; $menuArr[$tel]['keywords'] = $cat['meta_keywords']; $menuArr[$tel]['image'] = ''; if ($cat['categories_image']) { $menuArr[$tel]['image'] = '<img src="uploads/tx_multishop/images/categories/normal' . mslib_befe::getImagePath($cat['categories_image'], 'categories', 'normal') . '" alt="' . htmlspecialchars($cat['categories_name']) . '">'; } // get all cats to generate multilevel fake url $level = 0; $cats = mslib_fe::Crumbar($cat['categories_id']); $cats = array_reverse($cats); $where = ''; if (count($cats) > 0) { foreach ($cats as $tmp) { $where .= "categories_id[" . $level . "]=" . $tmp['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); } $link = mslib_fe::typolink($this->conf['shop_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); $menuArr[$tel]['_OVERRIDE_HREF'] = $link; if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { $GLOBALS['TT']->setTSlogMessage($error, 3); } else { $dataArray = mslib_fe::getSitemap($cat['categories_id'], array(), 0, 0); $menuArr[$tel]['_SUB_MENU'] = array(); if (count($dataArray)) { $sub_content = self::subMenuArray($dataArray); $menuArr[$tel]['_SUB_MENU'] = $sub_content; } } $tel++; } return $menuArr; }
if (count($cats) > 0) { foreach ($cats as $tmp) { $where .= "categories_id[" . $level . "]=" . $tmp['id'] . "&"; $level++; } $where = substr($where, 0, strlen($where) - 1); } $link = mslib_fe::typolink($this->conf['products_listing_page_pid'], '&' . $where . '&tx_multishop_pi1[page_section]=products_listing'); $cat_selectbox .= '<option value="' . $category['categories_id'] . '" id="sl-cat_' . $category['categories_id'] . '">+ ' . $category['categories_name'] . ' (ID: ' . $category['categories_id'] . ')</option>'; $category_action_icon = '<div class="action_icons"> <a href="' . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_category&cid=' . $category['categories_id']) . '&action=edit_category" class="text-success msadmin_edit_icon"><i class="fa fa-pencil"></i></a> <a href="' . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=delete_category&cid=' . $category['categories_id'] . '&action=delete_category') . '" class="text-danger msadmin_delete_icon" alt="' . $this->pi_getLL('admin_label_alt_remove') . '"><i class="fa fa-trash-o"></i></a> <a href="' . $link . '" target="_blank" class="text-primary msadmin_view"><i class="fa fa-eye"></i></a> </div>'; $subcat_list = ''; $dataArray = mslib_fe::getSitemap($category['categories_id'], array(), 1, 0); if (count($dataArray)) { $sub_content = mslib_fe::displayAdminCategories($dataArray, false, 0, $category['categories_id']); if ($sub_content) { $subcat_list .= '<ul class="sub_categories_ul">'; $subcat_list .= $sub_content; $subcat_list .= '</ul>'; } $cat_selectbox .= mslib_fe::displayAdminCategories($dataArray, true, 1, $category['categories_id']); } $markerArray = array(); $markerArray['COUNTER'] = $counter; $markerArray['EXTRA_CLASS'] = !$category['status'] ? 'msAdminCategoryDisabled' : ''; $markerArray['CATEGORY_ID'] = $category['categories_id']; $markerArray['CATEGORY_EDIT_LINK'] = mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[page_section]=edit_category&cid=' . $category['categories_id']) . '&action=edit_category'; $markerArray['CATEGORY_NAME'] = $category['categories_name'] . ' (ID: ' . $category['categories_id'] . ')';
public function getSitemap($categories_id, $array = array(), $include_disabled_categories = 0, $include_products = 1) { $str = "SELECT * from tx_multishop_categories c, tx_multishop_categories_description cd where c.page_uid='" . $this->showCatalogFromPage . "' "; if (!$include_disabled_categories) { $str .= "and c.status=1 "; } $str .= "and c.parent_id='" . $categories_id . "' and cd.language_id='" . $this->sys_language_uid . "' and c.categories_id=cd.categories_id order by c.sort_order"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); if ($GLOBALS['TYPO3_DB']->sql_num_rows($qry)) { // cats while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) { $array['subs'][] = mslib_fe::getSitemap($row['categories_id'], $row, $include_disabled_categories, $include_products); } } else { if ($include_products) { // products $products = mslib_fe::getProducts('', $categories_id); if (is_array($products)) { if (!count($array)) { // starting point doesnt have subcats, but products instead. $array['subs'][0]['products'] = $products; } else { $array['products'] = $products; } } } } return $array; }