[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 function tep_show_category($counter) { 14 global $tree, $categories_string, $cPath_array; 15 16 for ($i=0; $i<$tree[$counter]['level']; $i++) { 17 $categories_string .= " "; 18 } 19 20 $categories_string .= '<a href="'; 21 22 if ($tree[$counter]['parent'] == 0) { 23 $cPath_new = 'cPath=' . $counter; 24 } else { 25 $cPath_new = 'cPath=' . $tree[$counter]['path']; 26 } 27 28 $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; 29 30 if (isset($cPath_array) && in_array($counter, $cPath_array)) { 31 $categories_string .= '<b>'; 32 } 33 34 // display category name 35 $categories_string .= $tree[$counter]['name']; 36 37 if (isset($cPath_array) && in_array($counter, $cPath_array)) { 38 $categories_string .= '</b>'; 39 } 40 41 if (tep_has_category_subcategories($counter)) { 42 $categories_string .= '->'; 43 } 44 45 $categories_string .= '</a>'; 46 47 if (SHOW_COUNTS == 'true') { 48 $products_in_category = tep_count_products_in_category($counter); 49 if ($products_in_category > 0) { 50 $categories_string .= ' (' . $products_in_category . ')'; 51 } 52 } 53 54 $categories_string .= '<br>'; 55 56 if ($tree[$counter]['next_id'] != false) { 57 tep_show_category($tree[$counter]['next_id']); 58 } 59 } 60 ?> 61 <!-- categories //--> 62 <tr> 63 <td> 64 <?php 65 $info_box_contents = array(); 66 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); 67 68 new infoBoxHeading($info_box_contents, true, false); 69 70 $categories_string = ''; 71 $tree = array(); 72 73 $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 = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); 74 while ($categories = tep_db_fetch_array($categories_query)) { 75 $tree[$categories['categories_id']] = array('name' => $categories['categories_name'], 76 'parent' => $categories['parent_id'], 77 'level' => 0, 78 'path' => $categories['categories_id'], 79 'next_id' => false); 80 81 if (isset($parent_id)) { 82 $tree[$parent_id]['next_id'] = $categories['categories_id']; 83 } 84 85 $parent_id = $categories['categories_id']; 86 87 if (!isset($first_element)) { 88 $first_element = $categories['categories_id']; 89 } 90 } 91 92 //------------------------ 93 if (tep_not_null($cPath)) { 94 $new_path = ''; 95 reset($cPath_array); 96 while (list($key, $value) = each($cPath_array)) { 97 unset($parent_id); 98 unset($first_id); 99 $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 = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); 100 if (tep_db_num_rows($categories_query)) { 101 $new_path .= $value; 102 while ($row = tep_db_fetch_array($categories_query)) { 103 $tree[$row['categories_id']] = array('name' => $row['categories_name'], 104 'parent' => $row['parent_id'], 105 'level' => $key+1, 106 'path' => $new_path . '_' . $row['categories_id'], 107 'next_id' => false); 108 109 if (isset($parent_id)) { 110 $tree[$parent_id]['next_id'] = $row['categories_id']; 111 } 112 113 $parent_id = $row['categories_id']; 114 115 if (!isset($first_id)) { 116 $first_id = $row['categories_id']; 117 } 118 119 $last_id = $row['categories_id']; 120 } 121 $tree[$last_id]['next_id'] = $tree[$value]['next_id']; 122 $tree[$value]['next_id'] = $first_id; 123 $new_path .= '_'; 124 } else { 125 break; 126 } 127 } 128 } 129 tep_show_category($first_element); 130 131 $info_box_contents = array(); 132 $info_box_contents[] = array('text' => $categories_string); 133 134 new infoBox($info_box_contents); 135 ?> 136 </td> 137 </tr> 138 <!-- categories_eof //-->
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |