[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * @package admin 4 * @copyright Copyright 2003-2006 Zen Cart Development Team 5 * @copyright Portions Copyright 2003 osCommerce 6 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 7 * @version $Id: products_previous_next.php 3806 2006-06-19 16:18:12Z ajeh $ 8 */ 9 if (!defined('IS_ADMIN_FLAG')) { 10 die('Illegal Access'); 11 } 12 13 ///// 14 // BOF PREVIOUS NEXT 15 16 if ($prev_next_list=='') { 17 // calculate the previous and next 18 19 $check_type = $db->Execute("select products_type from " . TABLE_PRODUCTS . " where products_id='" . $products_filter . "'"); 20 define('PRODUCT_INFO_PREVIOUS_NEXT_SORT', zen_get_configuration_key_value_layout('PRODUCT_INFO_PREVIOUS_NEXT_SORT', $check_type->fields['products_type'])); 21 22 // sort order 23 switch(PRODUCT_INFO_PREVIOUS_NEXT_SORT) { 24 case (0): 25 $prev_next_order= ' order by LPAD(p.products_id,11,"0")'; 26 break; 27 case (1): 28 $prev_next_order= " order by pd.products_name"; 29 break; 30 case (2): 31 $prev_next_order= " order by p.products_model"; 32 break; 33 case (3): 34 $prev_next_order= " order by p.products_price, pd.products_name"; 35 break; 36 case (4): 37 $prev_next_order= " order by p.products_price, p.products_model"; 38 break; 39 case (5): 40 $prev_next_order= " order by pd.products_name, p.products_model"; 41 break; 42 default: 43 $prev_next_order= " order by pd.products_name"; 44 break; 45 } 46 47 48 // set current category 49 $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id); 50 51 if (!$current_category_id) { 52 $sql = "SELECT categories_id 53 from " . TABLE_PRODUCTS_TO_CATEGORIES . " 54 where products_id ='" . $products_filter . "'"; 55 56 $cPath_row = $db->Execute($sql); 57 $current_category_id = $cPath_row->fields['categories_id']; 58 } 59 60 $sql = "select p.products_id, pd.products_name 61 from " . TABLE_PRODUCTS . " p, " 62 . TABLE_PRODUCTS_DESCRIPTION . " pd, " 63 . TABLE_PRODUCTS_TO_CATEGORIES . " ptc 64 where p.products_id = pd.products_id and pd.language_id= '" . $_SESSION['languages_id'] . "' and p.products_id = ptc.products_id and ptc.categories_id = '" . $current_category_id . "'" . 65 $prev_next_order 66 ; 67 68 $products_ids = $db->Execute($sql); 69 } 70 71 // reset if not already set for display 72 ($_GET['products_filter'] == '' ? $_GET['products_filter'] = $products_filter : ''); 73 ($_GET['current_category_id'] == '' ? $_GET['current_category_id'] = $current_category_id : ''); 74 75 while (!$products_ids->EOF) { 76 $id_array[] = $products_ids->fields['products_id']; 77 $products_ids->MoveNext(); 78 } 79 80 // if invalid product id skip 81 if (is_array($id_array)) { 82 reset ($id_array); 83 $counter = 0; 84 while (list($key, $value) = each ($id_array)) { 85 if ($value == $products_filter) { 86 $position = $counter; 87 if ($key == 0) { 88 $previous = -1; // it was the first to be found 89 } else { 90 $previous = $id_array[$key - 1]; 91 } 92 if ($id_array[$key + 1]) { 93 $next_item = $id_array[$key + 1]; 94 } else { 95 $next_item = $id_array[0]; 96 } 97 } 98 $last = $value; 99 $counter++; 100 } 101 102 if ($previous == -1) $previous = $last; 103 104 $sql = "select categories_name 105 from " . TABLE_CATEGORIES_DESCRIPTION . " 106 where categories_id = '" . (int)$current_category_id . "' AND language_id = '" . $_SESSION['languages_id'] . "'"; 107 108 $category_name_row = $db->Execute($sql); 109 } // if is_array 110 111 /* 112 if (strstr($PHP_SELF, FILENAME_PRODUCTS_PRICE_MANAGER)) { 113 $curr_page = FILENAME_PRODUCTS_PRICE_MANAGER; 114 } else { 115 $curr_page = FILENAME_ATTRIBUTES_CONTROLLER; 116 } 117 */ 118 119 switch(true) { 120 case (strstr($PHP_SELF, FILENAME_ATTRIBUTES_CONTROLLER)): 121 $curr_page = FILENAME_ATTRIBUTES_CONTROLLER; 122 break; 123 case (strstr($PHP_SELF, FILENAME_PRODUCTS_TO_CATEGORIES)): 124 $curr_page = FILENAME_PRODUCTS_TO_CATEGORIES; 125 break; 126 default: 127 $curr_page = FILENAME_PRODUCTS_PRICE_MANAGER; 128 break; 129 } 130 // to display use products_previous_next_display.php 131 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |