[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> index.php (source)

   1  <?php
   2  /*

   3  $Id: index.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  // Most of this file is changed or moved to BTS - Basic Template System - format.

  14  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  15  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  16  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  17  
  18    require ('includes/application_top.php');
  19  
  20  // BOF: MOD - Customer Groups

  21  global $customer_group_id;
  22    if(!isset($customer_group_id)) { $customer_group_id = '0'; }
  23  // EOF: MOD - Customer Groups

  24  
  25  // the following cPath references come from application_top.php

  26    $category_depth = 'top';
  27    if (isset($cPath) && tep_not_null($cPath)) {
  28      $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
  29      $cateqories_products = tep_db_fetch_array($categories_products_query);
  30      if ($cateqories_products['total'] > 0) {
  31        $category_depth = 'products'; // display products

  32      } else {
  33        $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  34        $category_parent = tep_db_fetch_array($category_parent_query);
  35        if ($category_parent['total'] > 0) {
  36          $category_depth = 'nested'; // navigate through the categories

  37        } else {
  38          $category_depth = 'products'; // category has no products, but display the 'no products' message

  39        }
  40      }
  41    }
  42  
  43    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
  44  
  45    if ($category_depth == 'nested') {
  46  // BOF: MOD - Categories Description 1.5

  47  //    $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");

  48      $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");
  49  // EOF: MOD - Categories Description 1.5

  50  
  51      $category = tep_db_fetch_array($category_query);
  52  
  53      $content = CONTENT_INDEX_NESTED;
  54  
  55    } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
  56  // create column list

  57      $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
  58                           'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
  59                           'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
  60                           'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
  61                           'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
  62                           'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
  63                           'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
  64                           'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
  65  
  66      asort($define_list);
  67  
  68      $column_list = array();
  69      reset($define_list);
  70      while (list($key, $value) = each($define_list)) {
  71        if ($value > 0) $column_list[] = $key;
  72      }
  73  // BOF: MOD - Separate Pricing Per Customer

  74     if(!tep_session_is_registered('sppc_customer_group_id')) {
  75       $customer_group_id = '0';
  76       } else {
  77        $customer_group_id = $sppc_customer_group_id;
  78     }
  79     // this will build the table with specials prices for the retail group or update it if needed

  80     // this function should have been added to includes/functions/database.php

  81     if ($customer_group_id == '0') {
  82     tep_db_check_age_specials_retail_table();
  83     }
  84     $status_product_prices_table = false;
  85     $status_need_to_get_prices = false;
  86  
  87     // find out if sorting by price has been requested

  88     if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) && $customer_group_id != '0' ){
  89      $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  90      if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') {
  91        $status_need_to_get_prices = true;
  92        }
  93     }
  94     
  95     if ($status_need_to_get_prices == true && $customer_group_id != '0') { 
  96     $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id;
  97     // the table with product prices for a particular customer group is re-built only a number of times per hour

  98     // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes)

  99     // to trigger the update the next function is called (new function that should have been

 100     // added to includes/functions/database.php)

 101     tep_db_check_age_products_group_prices_cg_table($customer_group_id);
 102     $status_product_prices_table = true;
 103  
 104     } // end if ($status_need_to_get_prices == true && $customer_group_id != '0')

 105  // EOF: MOD - Separate Pricing Per Customer

 106  
 107      $select_column_list = '';
 108  
 109      for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
 110        switch ($column_list[$i]) {
 111          case 'PRODUCT_LIST_MODEL':
 112            $select_column_list .= 'p.products_model, ';
 113            break;
 114          case 'PRODUCT_LIST_NAME':
 115            $select_column_list .= 'pd.products_name, ';
 116            break;
 117          case 'PRODUCT_LIST_MANUFACTURER':
 118            $select_column_list .= 'm.manufacturers_name, ';
 119            break;
 120          case 'PRODUCT_LIST_QUANTITY':
 121            $select_column_list .= 'p.products_quantity, ';
 122            break;
 123          case 'PRODUCT_LIST_IMAGE':
 124            $select_column_list .= 'p.products_image, ';
 125            break;
 126          case 'PRODUCT_LIST_WEIGHT':
 127            $select_column_list .= 'p.products_weight, ';
 128            break;
 129        }
 130      }
 131  
 132  // BOF: MOD - Categories Description 1.5

 133  // Get the category name and description

 134      $category_query = tep_db_query("select cd.categories_name, cd.categories_heading_title, cd.categories_description, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");
 135      $category = tep_db_fetch_array($category_query);
 136  // EOF: MOD - Categories Description 1.5

 137  
 138  // show the products of a specified manufacturer

 139      if (isset($HTTP_GET_VARS['manufacturers_id'])) {
 140        if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
 141  // We are asked to show only a specific category

 142  // BOF: MOD - Separate Pricing Per Customer

 143  // LINE CHANGED: MS2 update 501112

 144  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

 145  // moved from before 'left' and put before 'where': , " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c

 146      if ($status_product_prices_table == true) {
 147      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
 148      } else { // either retail or no need to get correct special prices
 149      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
 150      } // end else { // either retail...

 151  // EOF: MOD - Separate Pricing Per Customer

 152        } else {
 153  // We show them all

 154  // BOF: MOD - Separate Pricing Per Customer

 155  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

 156          if ($status_product_prices_table == true) {
 157          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
 158      } else { // either retail or no need to get correct special prices
 159  // LINE CHANGED: MS2 update 501112

 160  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

 161  // moved from before 'left' and put before 'where': , " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m

 162          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
 163      } // end else { // either retail...

 164  // EOF: MOD - Separate Pricing Per Customer

 165        }
 166      } else {
 167  // show the products in a given categorie

 168        if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
 169  // We are asked to show only specific catgeory

 170  // BOF: MOD - Separate Pricing Per Customer

 171  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 172          if ($status_product_prices_table == true) {
 173          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
 174          } else { // either retail or no need to get correct special prices
 175  // LINE CHANGED: MS2 update 501112

 176  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 177  // moved from before 'left' and put before 'where': , " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c

 178          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
 179          } // end else { // either retail...

 180  // EOF: MOD - Separate Pricing Per Customer

 181        } else {
 182  // We show them all

 183  // BOF: MOD - Separate Pricing Per Customer

 184  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 185          if ($status_product_prices_table == true) {
 186          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
 187          } else { // either retail or no need to get correct special prices
 188  // LINE CHANGED: MS2 update 501112

 189  //      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

 190  // moved from before 'left' and put before 'where': , " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c 

 191          $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
 192        } // end else { // either retail...

 193  // EOF: MOD - Separate Pricing Per Customer

 194        }
 195      }
 196  
 197      if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
 198        for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
 199          if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
 200            $HTTP_GET_VARS['sort'] = $i+1 . 'a';
 201            $listing_sql .= " order by pd.products_name";
 202            break;
 203          }
 204        }
 205      } else {
 206        $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
 207        $sort_order = substr($HTTP_GET_VARS['sort'], 1);
 208  
 209        switch ($column_list[$sort_col-1]) {
 210          case 'PRODUCT_LIST_MODEL':
 211            $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
 212            break;
 213          case 'PRODUCT_LIST_NAME':
 214            $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
 215            break;
 216          case 'PRODUCT_LIST_MANUFACTURER':
 217            $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
 218            break;
 219          case 'PRODUCT_LIST_QUANTITY':
 220            $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
 221            break;
 222          case 'PRODUCT_LIST_IMAGE':
 223            $listing_sql .= " order by pd.products_name";
 224            break;
 225          case 'PRODUCT_LIST_WEIGHT':
 226            $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
 227            break;
 228          case 'PRODUCT_LIST_PRICE':
 229            $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
 230            break;
 231        }
 232      }
 233  
 234      $content = CONTENT_INDEX_PRODUCTS;
 235  
 236    } else { // default page
 237  
 238      $content = CONTENT_INDEX_DEFAULT;
 239  
 240    }
 241  
 242    include (bts_select('main', $content_template)); // BTSv1.5

 243  
 244    require (DIR_WS_INCLUDES . 'application_bottom.php');
 245  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7