[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/pages/index/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * index header_php.php

   4   *

   5   * @package page

   6   * @copyright Copyright 2003-2006 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: header_php.php 4371 2006-09-03 19:36:11Z ajeh $

  10   */
  11  
  12  // This should be first line of the script:

  13  $zco_notifier->notify('NOTIFY_HEADER_START_INDEX');
  14  
  15  // the following cPath references come from application_top/initSystem

  16  $category_depth = 'top';
  17  if (isset($cPath) && zen_not_null($cPath)) {
  18    $categories_products_query = "SELECT count(*) AS total
  19                                  FROM   " . TABLE_PRODUCTS_TO_CATEGORIES . "
  20                                  WHERE   categories_id = :categoriesID";
  21  
  22    $categories_products_query = $db->bindVars($categories_products_query, ':categoriesID', $current_category_id, 'integer');
  23    $categories_products = $db->Execute($categories_products_query);
  24  
  25    if ($categories_products->fields['total'] > 0) {
  26      $category_depth = 'products'; // display products

  27    } else {
  28      $category_parent_query = "SELECT count(*) AS total
  29                                FROM   " . TABLE_CATEGORIES . "
  30                                WHERE  parent_id = :categoriesID";
  31  
  32      $category_parent_query = $db->bindVars($category_parent_query, ':categoriesID', $current_category_id, 'integer');
  33      $category_parent = $db->Execute($category_parent_query);
  34  
  35      if ($category_parent->fields['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  // include template specific file name defines

  43  $define_page = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', FILENAME_DEFINE_MAIN_PAGE, 'false');
  44  require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  45  
  46  // set the product filters according to selected product type

  47  $typefilter = 'default';
  48  if (isset($_GET['typefilter'])) $typefilter = $_GET['typefilter'];
  49  require(DIR_WS_INCLUDES . zen_get_index_filters_directory($typefilter . '_filter.php'));
  50  
  51  // query the database based on the selected filters

  52  $listing = $db->Execute($listing_sql);
  53  
  54  // if only one product in this category, go directly to the product page, instead of displaying a link to just one item:

  55  // if filter_id exists the 1 product redirect is ignored

  56  if (SKIP_SINGLE_PRODUCT_CATEGORIES=='True' and (!isset($_GET['filter_id']) and !isset($_GET['alpha_filter']))) {
  57    if ($listing->RecordCount() == 1) {
  58      zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']));
  59    }
  60  }
  61  
  62  // This should be last line of the script:

  63  $zco_notifier->notify('NOTIFY_HEADER_END_INDEX');
  64  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics