function buildCategories($parent_id) { global $languages_id; $result = ''; $categories_query = tep_db_query("SELECT c.categories_id, cd.categories_name, c.parent_id FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND cd.language_id = '" . (int) $languages_id . "' AND c.parent_id = '" . $parent_id . "' ORDER BY c.sort_order, cd.categories_name"); $colcount = tep_db_num_rows($categories_query); if ($colcount > 0) { if ($colcount > 4) { $colcount = 4; } $result .= '<ul id="products_sitemap" class="col' . $colcount . '">'; $count = 0; while ($categories = tep_db_fetch_array($categories_query)) { if ($count == 0) { $result .= '<li class="first">'; } else { $result .= '<li>'; } $result .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $categories['categories_id']) . '" title="' . $categories['categories_name'] . ' - ' . STORE_NAME . '" class="sitemap">' . $categories['categories_name'] . '</a>'; if (tep_has_category_subcategories($categories['categories_id'])) { $result .= $this->buildCategories($categories['categories_id']); } else { if (tep_count_products_in_category($categories['categories_id']) > 0) { //$result .= $this->buildProducts($categories['categories_id']); } } $result .= '</li>'; $count++; } $result .= '</ul>'; } return $result; }
function tep_show_category($counter, $count) { global $tree, $categories_string, $cPath_array, $ii; if ($count == 0) { $kk = ' class="bg_list"'; } else { $kk = ' class="bg_list"'; } $count++; if (!$tree[$counter]['level']) { $categories_string .= $categories_string ? '' : ''; $categories_string .= '<li' . $kk . '><a href='; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $num_prod = ' (' . $products_in_category . ')'; } } if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link('index.php', $cPath_new) . '>'; // display categry name $categories_string .= $tree[$counter]['name']; $categories_string .= $num_prod . '</a></li>'; } else { // SUBCATEGORY if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $num_prod = ' (' . $products_in_category . ')'; } } $count = 2; $categories_string .= ''; $categories_string .= '<li class="bg_list_sub">'; for ($i = 0; $i < $tree[$counter]['level']; $i++) { $categories_string .= ' '; } $categories_string .= '<a href='; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link('index.php', $cPath_new) . '>'; // display category name $categories_string .= $tree[$counter]['name']; $categories_string .= $num_prod . '</a></li>'; } if ($tree[$counter]['next_id'] != false && $ii < 30) { tep_show_category($tree[$counter]['next_id'], $count); } }
function tep_show_categoryxc($cid, $cpath, $display_empty) { global $categoriesxc_string, $languages_id, $_GET; global $level; $selectedPath = array(); // Get all of the categories on this level $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 = " . $cid . " and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($level[$categories['parent_id']] == "") { $level[$categories['parent_id']] = 0; } $level[$categories['categories_id']] = $level[$categories['parent_id']] + 1; // Add category link to $categoriesxc_string $products_in_category = tep_count_products_in_category($categories['categories_id']); if ($display_empty == 0 && $products_in_category < 1) { $display_category = false; } else { $display_category = true; } if ($display_category == true) { $categoriesxc_string .= "\t<li><a href=\""; $cPath_new = $cpath; if ($level[$categories['parent_id']] > 0) { $cPath_new .= "_"; } $cPath_new .= $categories['categories_id']; $cPath_new_text = "cPath=" . $cPath_new; $categoriesxc_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text); $categoriesxc_string .= '" title="' . $categories['categories_name'] . '">'; if ($_GET['cPath']) { $selectedPath = split("_", $_GET['cPath']); } //if (in_array($categories['categories_id'], $selectedPath)) { $categoriesxc_string .= '<strong>'; } $categoriesxc_string .= $categories['categories_name']; //if (in_array($categories['categories_id'], $selectedPath)) { $categoriesxc_string .= '</strong>'; } $categoriesxc_string .= '</a>'; if (SHOW_COUNTS) { if ($products_in_category > 0) { $categoriesxc_string .= ' (' . $products_in_category . ')'; } } // If I have subcategories, get them and show them if (tep_has_category_subcategories($categories['categories_id'])) { $categoriesxc_string .= "<ul id=\"catid" . $categories['categories_id'] . "\" title=\"" . $categories['categories_name'] . "\">\n"; tep_show_categoryxc($categories['categories_id'], $cPath_new, $display_empty); $categoriesxc_string .= "</ul>\n"; } $categoriesxc_string .= "</li>\n"; } } }
function tep_show_category($counter) { // Category Optimization global $tree, $categories_string, $cPath_array, $parent_child; for ($i = 0; $i < $tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } // BOF tep_show_category optimization /* if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } */ // foreach ($parent_child as $index_of => $sub_parent_child) { if ($counter == $sub_parent_child['parent_id']) { // a category has this one as a parent, so parent has a subcategory $categories_string .= '->'; break; // } } // end foreach ($parent_child as $index_of => $sub_parent_child) // EOF tep_show_category optimization $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } }
function tep_show_category_row($counter) { global $tree, $categories_string, $cPath_array; $cPath_new = 'cPath=' . $counter; $categories_string .= '<span class="headerCategoriesItems">'; $categories_string .= '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; $categories_string .= $tree[$counter]['name']; $categories_string .= '</a>'; if (SHOW_COUNTS == 'false') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '</span>'; if ($tree[$counter]['next_id'] != false) { tep_show_category_row($tree[$counter]['next_id']); } }
/** * $Id: categories.php 57 2005-12-15 14:39:09Z Michael $ * osCommerce, Open Source E-Commerce Solutions * http://www.oscommerce.com * Copyright (c) 2003 osCommerce * Released under the GNU General Public License * adapted 2005 for xoops 2.0.x by FlinkUX e.K. <http://www.flinkux.de> * (c) 2005 Michael Hammelmann <*****@*****.**> * @package xosC * @author Michael Hammelmann <*****@*****.**> * @version 1 **/ function tep_show_category($tmp_counter, $cat_string, $tmp_tree, $cPath_array) { $tree = $tmp_tree; $counter = $tmp_counter; $categories_string = ""; for ($i = 0; $i < $tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= '->'; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { // $categories_string.="tep_show_category(".$tree[$counter]['next_id'].",".$categories_string.",".$tree.",".$cPath_array.")"; $categories_string .= tep_show_category($tree[$counter]['next_id'], $categories_string, $tree, $cPath_array); } return $categories_string; }
function preorder_mc($cid_cat, $level_cat, $foo_cat, $cpath_cat) { global $categories_string_cat, $_GET; // Display link if ($cid_cat != 0) { for ($i = 0; $i < $level_cat; $i++) { $categories_string_cat .= ' '; } $categories_string_cat .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath =' . $cpath_cat . $cid_cat) . '">'; // 1.6 Are we on the "path" to selected category? $bold = strstr($_GET['cPath'], $cpath_cat . $cid_cat . '_') || $_GET['cPath'] == $cpath_cat . $cid_cat; // 1.6 If yes, use <b> if ($bold) { $categories_string_cat .= '<b>'; } $categories_string_cat .= $foo_cat[$cid_cat]['name']; if ($bold) { $categories_string_cat .= '</b>'; } $categories_string_cat .= '</a>'; // 1.4 SHOW_COUNTS is 'true' or 'false', not true or false if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($cid_cat); if ($products_in_category > 0) { $categories_string_cat .= ' (' . $products_in_category . ')'; } } $categories_string_cat .= '<br>'; } // Traverse category tree if (is_array($foo_cat)) { foreach ($foo_cat as $key => $value) { if ($foo_cat[$key]['parent'] == $cid_cat) { preorder_mc($key, $level_cat + 1, $foo_cat, $level_cat != 0 ? $cpath_cat . $cid_cat . '_' : ''); } } } }
function tep_show_category($counter) { global $tree, $categories_string, $cPath_array; for ($i = 0; $i < $tree[$counter]['level']; $i++) { $categories_string .= " "; } $categories_string .= '<a href="'; if ($tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $tree[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '<b>'; } // display category name $categories_string .= $tree[$counter]['name']; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $categories_string .= '</b>'; } if (tep_has_category_subcategories($counter)) { $categories_string .= ''; } $categories_string .= '</a>'; if (SHOW_COUNTS == 'false') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } }
private function build_categories_string($counter) { global $cPath_array, $column_location; // end background variables $this->categories_string .= '<ul class="box-information_pages-ul list-unstyled list-indent-large">'; $style_padding = "0"; for ($i = 0; $i < $this->tree[$counter]['level']; $i++) { //$this->categories_string .= " "; $style_padding += 10; } $css_indent = ''; if ($style_padding > 0) { $css_indent = ' style="padding-left:' . $style_padding . 'px"'; } $this->categories_string .= '<li' . $css_indent . '>'; $this->categories_string .= '<a href="'; if ($this->tree[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $this->tree[$counter]['path']; } $this->categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (isset($cPath_array) && in_array($counter, $cPath_array)) { $this->categories_string .= '<b>'; } // display category name $this->categories_string .= tep_db_decoder($this->tree[$counter]['name']); if (isset($cPath_array) && in_array($counter, $cPath_array)) { $this->categories_string .= '</b>'; } $this->categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $this->categories_string .= ' <span class="category_count">(' . $products_in_category . ')</span>'; } } $this->categories_string .= '</li></ul>' . "\n"; if ($this->tree[$counter]['next_id'] != false) { $this->build_categories_string($this->tree[$counter]['next_id']); } }
function tep_make_cat_ulbranch($parcat, $table, $level, $maxlevel) { global $cPath_array, $classname_for_selected, $classname_for_parent; $list = $table[$parcat]; while (list($key, $val) = each($list)) { if ($GLOBALS['this_level'] != $level) { if ($GLOBALS['this_level'] < $level) { $output .= "\n" . '<ul>'; } else { for ($nest = 1; $nest <= $GLOBALS['this_level'] - $level; $nest++) { $output .= '</ul></li>' . "\n"; } /* if ($GLOBALS['this_level'] -1 == $level) $output .= '</ul></li>'."\n"; elseif ($GLOBALS['this_level'] -2 == $level) $output .= '</ul></li></ul></li>'."\n"; elseif ($GLOBALS['this_level'] -3 == $level) $output .= '</ul></li></ul></li></ul></li>'."\n"; elseif ($GLOBALS['this_level'] -4 == $level) $output .= '</ul></li></ul></li></ul></li></ul></li>'."\n"; */ } $GLOBALS['this_level'] = $level; } if (isset($cPath_array) && in_array($key, $cPath_array) && $classname_for_selected) { $this_cat_class = ' class="' . $classname_for_selected . '"'; } else { $this_cat_class = ''; } $output .= '<li' . $this_cat_class . '><a href="'; if (!$level) { unset($GLOBALS['cPath_set']); $GLOBALS['cPath_set'][0] = $key; $cPath_new = 'cPath=' . $key; } else { $GLOBALS['cPath_set'][$level] = $key; $cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, $level + 1)); } if (tep_has_category_subcategories($key) && $classname_for_parent) { $this_parent_class = ' class="' . $classname_for_parent . '"'; } else { $this_parent_class = ''; } $output .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '"' . $this_parent_class . '>' . $val; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($key); if ($products_in_category > 0) { $output .= ' (' . $products_in_category . ')'; } } $output .= '</a>'; if (!tep_has_category_subcategories($key)) { $output .= '</li>' . "\n"; } if (isset($table[$key]) and ($maxlevel > $level + 1 or $maxlevel == '0')) { $output .= tep_make_cat_ulbranch($key, $table, $level + 1, $maxlevel); } } // End while loop return $output; }
function build_menus($currentParID, $menustr, $catstr, $indent) { global $categories_string, $id, $languages_id; $tmpCount; $tmpCount = 0; $haschildren = 0; //default $categories_query_catmenu = 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 = '" . $currentParID . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id . "' and c.categories_id!=21 and c.categories_id!=23 order by sort_order, cd.categories_name"); $numberOfRows = tep_db_num_rows($categories_query_catmenu); $currentRow = 0; while ($categories = tep_db_fetch_array($categories_query_catmenu)) { $currentRow++; $catName = $categories['categories_name']; $tmpCount += 1; $haschildren = tep_has_category_subcategories($categories['categories_id']); if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($categories['categories_id']); if ($products_in_category > 0) { $catName .= ' (' . $products_in_category . ')'; } } if ($catstr != '') { $cPath_new = 'cPath=' . $catstr . '_' . $categories['categories_id']; } else { $indent = 0; $cPath_new = 'cPath=' . $categories['categories_id']; } if ($menustr != '') { $menu_tmp = $menustr . '_' . $tmpCount; } else { $menu_tmp = $tmpCount; } $indentStr = ""; for ($i = 0; $i < $indent; $i++) { $indentStr .= " "; } $categories_string .= $indentStr . "[null, '" . $catName . "','" . tep_href_link(FILENAME_DEFAULT, $cPath_new) . "','_self','" . $tmpString . "'"; if ($haschildren) { $indent += 1; $categories_string .= ",\n"; if ($menustr != '') { $menu_tmp = $menustr . '_' . $tmpCount; } else { $menu_tmp = $tmpCount; } if ($catstr != '') { $cat_tmp = $catstr . '_' . $categories['categories_id']; } else { $cat_tmp = $categories['categories_id']; } $NumChildren = build_menus($categories['categories_id'], $menu_tmp, $cat_tmp, $indent); if ($currentRow < $numberOfRows) { $categories_string .= $indentStr . "],\n"; } else { $categories_string .= $indentStr . "]\n"; } } else { if ($currentRow < $numberOfRows) { $categories_string .= "],\n"; } else { $categories_string .= "]\n"; } $NumChildren = 0; } } return $tmpCount; }
function tep_count_products_in_category($category_id, $include_inactive = false) { $OSCOM_Db = Registry::get('Db'); $products_count = 0; $products_query = 'select count(*) as total from :table_products p, :table_products_to_categories p2c where p.products_id = p2c.products_id and p2c.categories_id = :categories_id'; if ($include_inactive == false) { $products_query .= ' and p.products_status = 1'; } $Qproducts = $OSCOM_Db->prepare($products_query); $Qproducts->bindInt(':categories_id', $category_id); $Qproducts->execute(); if ($Qproducts->fetch() !== false) { $products_count += $Qproducts->valueInt('total'); } $Qcategories = $OSCOM_Db->prepare('select categories_id from :table_categories where parent_id = :parent_id'); $Qcategories->bindInt(':parent_id', $category_id); $Qcategories->execute(); if ($Qcategories->fetch() !== false) { do { $products_count += tep_count_products_in_category($Qcategories->valueInt('categories_id'), $include_inactive); } while ($Qcategories->fetch()); } return $products_count; }
function tep_show_category3($cid, $cpath, $COLLAPSABLE, $level = 0) { global $categories_string3, $languages_id, $categories; $selectedPath = array(); // Get all of the categories on this level $level++; $customer_group_array = array(); if (!isset($_SESSION['sppc_customer_group_id'])) { $customer_group_array[] = 'G'; } else { $customer_group_array = tep_get_customers_access_group($_SESSION['customer_id']); } $categories_query_raw = "SELECT c.categories_id, cd.categories_name, c.parent_id\r\n from " . TABLE_CATEGORIES . " c,\r\n " . TABLE_CATEGORIES_DESCRIPTION . " cd\r\n WHERE c.parent_id = '" . $cid . "'\r\n and c.categories_id = cd.categories_id\r\n and cd.language_id='" . $languages_id . "'"; $categories_query_raw .= tep_get_access_sql('c.products_group_access', $customer_group_array); $categories_query_raw .= " ORDER BY sort_order, cd.categories_name"; $categories_query = tep_db_query($categories_query_raw); while ($categories = tep_db_fetch_array($categories_query)) { if (!isset($categories[$level]['parent_id']) || $categories[$level]['parent_id'] == "") { $categories[$level]['parent_id'] = 0; } $categories[$level]['categories_id'] = $categories[$level]['parent_id'] + 1; // Add category link to $categories_string3 for ($a = 1; $a < $level; $a++) { $categories_string3 .= " "; } $categories_string3 .= '<a href="'; $cPath_new = $cpath; // if ($categories[$level]['parent_id'] > 0) { if ($categories['parent_id'] > 0) { $cPath_new .= "_"; } $cPath_new .= $categories['categories_id']; // added for CDS CDpath support $CDpath = isset($_SESSION['CDpath']) ? '&CDpath=' . $_SESSION['CDpath'] : ''; $cPath_new_text = "cPath=" . $cPath_new . $CDpath; $categories_string3 .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text); $categories_string3 .= '">'; if ($_GET['cPath']) { $selectedPath = explode("_", $_GET['cPath']); } if (in_array($categories['categories_id'], $selectedPath)) { $categories_string3 .= '<b>'; } if ($categories[$level]['categories_id'] == 1) { $categories_string3 .= '<u>'; } $categories_string3 .= tep_db_decoder($categories['categories_name']); if ($COLLAPSABLE && tep_has_category_subcategories($categories['categories_id'])) { $categories_string3 .= ' ->'; } if ($categories[$level]['categories_id'] == 1) { $categories_string3 .= '</u>'; } if (in_array($categories['categories_id'], $selectedPath)) { $categories_string3 .= '</b>'; } $categories_string3 .= '</a>'; if (SHOW_COUNTS) { $products_in_category = tep_count_products_in_category($categories['categories_id']); if ($products_in_category > 0) { $categories_string3 .= ' (' . $products_in_category . ')'; } } $categories_string3 .= '<br>'; // If I have subcategories, get them and show them if (tep_has_category_subcategories($categories['categories_id'])) { if ($COLLAPSABLE) { if (in_array($categories['categories_id'], $selectedPath)) { tep_show_category3($categories['categories_id'], $cPath_new, $COLLAPSABLE, $level); } } else { tep_show_category3($categories['categories_id'], $cPath_new, $COLLAPSABLE, $level); } } } }
function tep_get_categories_breadcrumb($cat_id, $extension, $breadcrumb = '') { $query = tep_db_query('SELECT cd.categories_name, c.parent_id FROM categories c, categories_description cd WHERE c.categories_id = cd.categories_id AND cd.categories_id = "' . $cat_id . '" AND cd.language_id = 1'); while ($cats_name = tep_db_fetch_array($query)) { if (tep_count_products_in_category($cat_id) > 0) { $type = 'products'; } else { $subcats = tep_db_query('SELECT categories_id FROM categories WHERE parent_id = "' . $cat_id . '"'); if (tep_db_num_rows($subcats) > 0) { $type = 'categories'; } else { $type = 'none'; } } $breadcrumb = '<a href="' . tep_href_link('index.php', 'extension=' . $extension . '&type=' . $type . '&cPath=' . $cat_id) . '" title="' . $cats_name['categories_name'] . '">' . $cats_name['categories_name'] . '</a> >> ' . $breadcrumb; if ($cats_name['parent_id'] == 0) { return substr($breadcrumb, 0, -3); } else { return tep_get_categories_breadcrumb($cats_name['parent_id'], $extension, $breadcrumb); } } }
function generate_shopinfo() { global $languages_id, $language_code, $currency, $currency_rate; // Alle Includes hier, wegen der Pfadangabe. Reihenfolge ist relevant! require ELMAR_PATH . 'tools/pear.php'; require ELMAR_PATH . 'tools/node.php'; require ELMAR_PATH . 'tools/parser.php'; require ELMAR_PATH . 'tools/tree.php'; $attributes = '1.0" encoding="ISO-8859-1'; $tree = new XML_Tree(NULL, $attributes); if (ELMAR_NEW_SHOPINFO_XML) { $XMLarray = array('xmlns' => 'http://elektronischer-markt.de/schema/shopinfo-2.0', 'xmlns:c' => 'http://elektronischer-markt.de/schema/categories-2.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://elektronischer-markt.de/schema/shopinfo-2.0 ' . ELMAR_SCHEMA_BASE_URL . 'shopinfo-2.0.xsd', 'version' => '2.0'); $root =& $tree->addRoot('Shop', NULL, $XMLarray); } else { $XMLarray = array('xmlns:osp' => 'http://elektronischer-markt.de/schema', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'http://elektronischer-markt.de/schema ' . ELMAR_SCHEMA_BASE_URL . 'shop.xsd'); $root =& $tree->addRoot('osp:Shop', NULL, $XMLarray); } $common =& $root->addChild("Common"); $xml_version =& $common->addChild("Version", ELMAR_NEW_SHOPINFO_XML ? '2.0' : '1.1'); $xml_language =& $common->addChild("Language", $language_code); $xml_currency =& $common->addChild("Currency", $currency); if (ELMAR_NEW_SHOPINFO_XML) { $xml_generator =& $common->addChild('Generator', 'Elm@r-Modul osCommerce/' . MODUL_VERSION . '.' . MODUL_SUBVERSION . ' (http://projekt.wifo.uni-mannheim.de/elmar/nav/osCommerce)'); } $name =& $root->addChild("Name", shopNameOrHost()); $shopUrl = ELMAR_SHOP_ROOT_DIR; //tep_href_link('index.php', '', 'NONSSL', false); $url =& $root->addChild("Url", $shopUrl); $requests =& $root->addChild("Requests"); // Die Parameter fuer die Echtzeitanfrage, siehe elmar_request.php $requestUrl = ELMAR_SHOP_ROOT_DIR . 'elmar_request.php'; // Url zur Echtzeitabfrage $onlineRequest =& $requests->addChild("OnlineRequest", Null, array("method" => "GET POST TRACE")); $processor =& $onlineRequest->addChild("Processor", $requestUrl); $paramBrand =& $onlineRequest->addChild("ParamBrand", 'p_brand'); $paramProduct =& $onlineRequest->addChild("ParamProduct", 'p_product'); $paramDescription =& $onlineRequest->addChild("ParamDescription", 'p_desc'); if (defined('ELMAR_PRODUCTS_EAN_FIELD')) { $paramEan =& $onlineRequest->addChild("ParamID", 'p_ean', array("type" => "EAN")); } if (defined('ELMAR_PRODUCTS_ISBN_FIELD')) { $paramIsbn =& $onlineRequest->addChild("ParamID", 'p_isbn', array("type" => "ISBN")); } if (ELMAR_NEW_SHOPINFO_XML) { $paramId =& $onlineRequest->addChild("ParamID", 'p_id', array("type" => "ID")); } $paramQuickSearch =& $onlineRequest->addChild("ParamQuickSearch", 'p_qs'); $paramPriceBounds =& $onlineRequest->addChild("ParamPriceBounds"); $lowerPrice =& $paramPriceBounds->addChild("LowerPrice", 'p_low'); $upperPrice =& $paramPriceBounds->addChild("UpperPrice", 'p_high'); $paramSize =& $onlineRequest->addChild("ParamSize", 'p_size'); $paramIP =& $onlineRequest->addChild("ParamIP", 'p_ip'); $offlineRequest =& offlineRequest($requests); if (ELMAR_NEW_SHOPINFO_XML) { $affiliateRequest =& $requests->addChild('AffiliateRequest', NULL, array('method' => 'GET POST TRACE')); $processor =& $affiliateRequest->addChild('Processor', ELMAR_SHOP_ROOT_DIR . 'elmar_affiliate.php'); $paramName =& $affiliateRequest->addChild('ParamName', 'name'); } /* $interface = & $root->addChild("Interface"); $positionLimit = & $interface->addChild("PositionLimit"); */ if (defined('STORE_LOGO') && file_exists(DIR_FS_CATALOG . DIR_WS_IMAGES . STORE_LOGO)) { $logo =& $root->addChild("Logo", IMAGE_PATH . STORE_LOGO); } /* $address = & $root->addChild("Adress"); $company= & $address->addChild("Company"); $street = & $address->addChild("Street"); $city = & $address->addChild("City"); */ if (emailOk()) { $contact =& $root->addChild("Contact"); $publicMailAddress =& $contact->addChild("PublicMailAddress", STORE_OWNER_EMAIL_ADDRESS); $privateMailAddress =& $contact->addChild("PrivateMailAddress", STORE_OWNER_EMAIL_ADDRESS); } /* $orderPhone = & $contact->addChild("OrderPhone"); $number= & $orderPhone->addChild("Number"); $costPerMinute= & $orderPhone->addChild("CostPerMinute"); $orderFax= & $contact->addChild("OrderFax"); $number = & $orderFax->addChild("Number"); $costPerMinute= & $orderFax->addChild("CostPerMinute"); $hotline = & $contact->addChild("Hotline"); */ $prodSum = productAnz(); $categories =& $root->addChild("Categories"); if ($prodSum > 0) { $totalProductCount =& $categories->addChild("TotalProductCount", $prodSum); } $ns = ELMAR_NEW_SHOPINFO_XML ? 'c:' : ''; $attrib = ELMAR_NEW_SHOPINFO_XML ? array('lang' => $language_code) : NULL; $mapOther = $language_code == 'de' ? 'Sonstiges' : 'Other'; // Die Produktkategorien der ersten Ebene schreiben. Durch "group by" Doppelte herauswerfen. $categories_query = tep_db_query('select c.categories_id, cd.categories_name from ' . TABLE_CATEGORIES . ' c left join ' . TABLE_CATEGORIES_DESCRIPTION . ' cd using(categories_id) where c.parent_id=0 and cd.language_id=' . (int) $languages_id . ' group by cd.categories_name'); if (tep_db_num_rows($categories_query)) { while ($category = tep_db_fetch_array($categories_query)) { $categories_name = trim($category['categories_name']); if ($categories_name != '') { $item =& $categories->addChild("Item", NULL, $attrib); $name =& $item->addChild($ns . "Name", $categories_name); if (function_exists('tep_count_products_in_category') && ($cpic = tep_count_products_in_category($category['categories_id']))) { $productCount =& $item->addChild($ns . "ProductCount", $cpic); } $mapping =& $item->addChild($ns . "Mapping", KategorieAnpassen($category['categories_name'], $mapOther)); } } } else { $item =& $categories->addChild("Item", NULL, $attrib); $name =& $item->addChild($ns . "Name", $mapOther); if ($prodSum > 0) { $productCount =& $item->addChild($ns . "ProductCount", $prodSum); } $mapping =& $item->addChild($ns . "Mapping", $mapOther); } $lastschriftverfahren = defined('MODULE_PAYMENT_BANKTRANSFER_STATUS') && MODULE_PAYMENT_BANKTRANSFER_STATUS == 'True' ? true : false; $nachnahme = defined('MODULE_PAYMENT_COD_STATUS') && MODULE_PAYMENT_COD_STATUS == 'True' ? true : false; $paypal = defined('MODULE_PAYMENT_PAYPAL_STATUS') && MODULE_PAYMENT_PAYPAL_STATUS == 'True' ? true : false; $rechnung = defined('MODULE_PAYMENT_INVOICE_STATUS') && MODULE_PAYMENT_INVOICE_STATUS == 'True' ? true : false; $vorkasse = defined('MODULE_PAYMENT_MONEYORDER_STATUS') && MODULE_PAYMENT_MONEYORDER_STATUS == 'True' ? true : false; #$barzahlung = (defined('MODULE_PAYMENT_CASH_STATUS') && (MODULE_PAYMENT_CASH_STATUS == 'True')) ? true : false; #e-cash (elektronisches Zahlungsmittel); money transfer (Ueberweisung); cheque (Scheck) if ($nachnahme || $paypal || $lastschriftverfahren || $rechnung || $vorkasse) { $payment =& $root->addChild("Payment"); if ($nachnahme) { $item =& $payment->addChild("Item"); $name =& $item->addChild("Name", 'on delivery'); // Nachnahme //$surcharge = & $item->addChild("Surcharge"); //$maxSurcharge = & $item->addChild("MaxSurcharge"); //$relativeSurcharge = & $item->addChild("RelativeSurcharge"); } if ($paypal) { $item =& $payment->addChild("Item"); $name =& $item->addChild("Name", 'paypal'); // PayPal } if ($lastschriftverfahren) { $item =& $payment->addChild("Item"); $name =& $item->addChild("Name", 'debit'); // Bankeinzug/Lastschrift } if ($rechnung) { $item =& $payment->addChild("Item"); $name =& $item->addChild("Name", 'invoice'); // Rechnung } if ($vorkasse) { $item =& $payment->addChild("Item"); $name =& $item->addChild("Name", 'pre-payment'); // Vorauszahlung } } $free_shipping = defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true' ? true : false; $shipping_flat_status = defined('MODULE_SHIPPING_FLAT_STATUS') && MODULE_SHIPPING_FLAT_STATUS == 'True' ? true : false; if ($free_shipping || $shipping_flat_status) { $forwardExpenses =& $root->addChild("ForwardExpenses"); if ($shipping_flat_status) { if (DISPLAY_PRICE_WITH_TAX == 'true') { $shipping_flat_cost = tep_add_tax(MODULE_SHIPPING_FLAT_COST, tep_get_tax_rate(MODULE_SHIPPING_FLAT_TAX_CLASS, STORE_COUNTRY, MODULE_SHIPPING_FLAT_ZONE)); } else { $shipping_flat_cost = MODULE_SHIPPING_FLAT_COST; } $flatRate =& $forwardExpenses->addChild("FlatRate", number_format($shipping_flat_cost * $currency_rate, 2)); } if ($free_shipping) { $upperBound =& $forwardExpenses->addChild("UpperBound", number_format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER * $currency_rate, 2)); } } /* $features = & $root->addChild("Features"); $installment = & $features->addChild("Installment"); $orderTracking = & $features->addChild("OrderTracking"); $deliverTracking = & $features->addChild("DeliverTRacking"); $installationAssistance = & $features->addChild("InstallationAssistance"); $repairService = & $features->addChild("RepairService"); $careAfterPurchase = & $features->addChild("CareAfterPurchase"); $giftService = & $features->addChild("GiftService"); */ $technology =& $root->addChild("Technology"); if (ENABLE_SSL) { $ssl =& $technology->addChild("SSL"); } $search =& $technology->addChild("Search"); // $set = & $technology->addChild("SET"); if (defined('FILENAME_CONDITIONS')) { $termAndConditions =& $root->addChild("TermsAndConditions"); $url =& $termAndConditions->addChild("Url", tep_href_link(FILENAME_CONDITIONS, '', 'NONSSL', false)); // $return = & $termAndConditions->addChild("Return"); } /* $specialDiscount = & $root->addChild("SpecialDiscount"); $description = & $specialDiscount->addChild("Description"); $url = & $specialDiscount->addChild("Url"); $certifications= & $root->addChild("Certifications"); $item = & $certifications->addChild("Item"); $self_Discription = & $root->addChild("Self-Discription"); */ $content = $tree->get(); $content = str_replace(''', '\'', $content); // ersetzen von ' $content = str_replace('|', '|', $content); // ersetzen von | return $content; }
function tep_count_products_in_category($category_id, $include_inactive = false) { // BOF Separate Pricing Per Customer, hide products and categories for groups global $sppc_customer_group_id; if (!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $products_count = 0; if ($include_inactive == true) { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id = p2c.products_id and p2c.categories_id = '" . (int) $category_id . "' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0"); } else { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int) $category_id . "' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0"); } $products = tep_db_fetch_array($products_query); $products_count += $products['total']; // no need to find child categories that are hidden from this customer or have a higher level category that is hidden $child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int) $category_id . "' and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0"); // EOF Separate Pricing Per Customer, hide products and categories for groups if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { $products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive); } } return $products_count; }
function tep_count_products_in_category($category_id, $include_inactive = false) { $products_count = 0; if ($include_inactive == true) { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int) $category_id . "'"); } else { $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int) $category_id . "'"); } $products = tep_db_fetch_array($products_query); $products_count += $products['total']; $child_categories_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int) $category_id . "'"); if (tep_db_num_rows($child_categories_query)) { while ($child_categories = tep_db_fetch_array($child_categories_query)) { $products_count += tep_count_products_in_category($child_categories['categories_id'], $include_inactive); } } return $products_count; }
function tep_show_category($counter) { $boxContent = ''; $catlevel = '0'; $boxContent .= '<table border="0" cellpadding="0" cellspacing="0" width="100%">'; // BoF - Contribution Category Box Enhancement 1.1 global $tree, $boxContent, $cPath_array, $cat_name, $customer_group_id, $box_width; $cPath_new = 'cPath=' . $tree[$counter]['path']; $boxContent .= '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr'; for ($i = 0; $i < $tree[$counter]['level']; $i++) { $catlevel .= $i; } $boxContent .= ' class="level' . $catlevel . '">'; // Add control for detecting last item in menu if ($tree[$counter]['next_id'] != false) { $boxContent .= '<td width="' . $box_width . '" class="menuItem">'; } else { $boxContent .= '<td width="' . $box_width . '" class="menuItemLast">'; } for ($i = 0; $i < $tree[$counter]['level']; $i++) { $boxContent .= " "; } $boxContent .= '<a class="' . $catlevel . 'level" href="'; $boxContent .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if (tep_has_category_subcategories($counter)) { $boxContent .= tep_image(DIR_WS_ICONS . 'pointer_blue.gif', ''); } else { $boxContent .= tep_image(DIR_WS_ICONS . 'pointer_blue_light.gif', ''); } // highlights the active chain if (isset($cPath_array) && in_array($counter, $cPath_array)) { $boxContent .= '<b>'; } if ($cat_name == $tree[$counter]['name']) { $boxContent .= '<span class="selectedCat">'; } // highlights the active category name when it is selected $boxContent .= $tree[$counter]['name']; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) { $boxContent .= ' (' . $products_in_category . ')'; } } if ($cat_name == $tree[$counter]['name']) { $boxContent .= '</span>'; } if (isset($cPath_array) && in_array($counter, $cPath_array)) { $boxContent .= '</b>'; } // EoF Category Box Enhancement $boxContent .= '</a></td>'; /////////////ADD IN PLUS SIGN //////////////////////// if (tep_has_category_subcategories($counter)) { if ($tree[$counter]['next_id'] != false) { $boxContent .= '<td width="10" class="menuItem"><a class="' . $catlevel . 'level" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_ICONS . 'plus.gif', '') . '</a></td>'; } else { $boxContent .= '<td width="10" class="menuItemLast"><a class="' . $catlevel . 'level" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_ICONS . 'plus.gif', '') . '</a></td>'; } } ////////////////////////////////////////////////////// $boxContent .= '</tr></table>'; // $boxContent .= '<br>'; if ($tree[$counter]['next_id'] != false) { tep_show_category($tree[$counter]['next_id']); } }