[ 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/account_history/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * Header code file for the Account History page

   4   *

   5   * @package page

   6   * @copyright Copyright 2003-2005 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 3160 2006-03-11 01:37:18Z drbyte $

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

  12  $zco_notifier->notify('NOTIFY_HEADER_START_ACCOUNT_HISTORY');
  13  
  14  
  15  if (!$_SESSION['customer_id']) {
  16    $_SESSION['navigation']->set_snapshot();
  17    zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  18  }
  19  
  20  require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  21  $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
  22  $breadcrumb->add(NAVBAR_TITLE_2);
  23  
  24  $orders_total = zen_count_customer_orders();
  25  
  26  if ($orders_total > 0) {
  27    $history_query_raw = "SELECT o.orders_id, o.date_purchased, o.delivery_name,
  28                                 o.billing_name, ot.text as order_total, s.orders_status_name
  29                          FROM   " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s
  30                          WHERE      o.customers_id = :customersID
  31                          AND        o.orders_id = ot.orders_id
  32                          AND        ot.class = 'ot_total'
  33                          AND        o.orders_status = s.orders_status_id
  34                          AND        s.language_id = :languagesID
  35                          ORDER BY   orders_id DESC";
  36  
  37    $history_query_raw = $db->bindVars($history_query_raw, ':customersID', $_SESSION['customer_id'], 'integer');
  38    $history_query_raw = $db->bindVars($history_query_raw, ':languagesID', $_SESSION['languages_id'], 'integer');
  39    $history_split = new splitPageResults($history_query_raw, MAX_DISPLAY_ORDER_HISTORY);
  40    $history = $db->Execute($history_split->sql_query);
  41  
  42    $accountHistory = array();
  43    $accountHasHistory = true;
  44    while (!$history->EOF) {
  45      $products_query = "SELECT count(*) AS count
  46                         FROM   " . TABLE_ORDERS_PRODUCTS . "
  47                         WHERE  orders_id = :ordersID";
  48  
  49      $products_query = $db->bindVars($products_query, ':ordersID', $history->fields['orders_id'], 'integer');
  50      $products = $db->Execute($products_query);
  51  
  52      if (zen_not_null($history->fields['delivery_name'])) {
  53        $order_type = TEXT_ORDER_SHIPPED_TO;
  54        $order_name = $history->fields['delivery_name'];
  55      } else {
  56        $order_type = TEXT_ORDER_BILLED_TO;
  57        $order_name = $history->fields['billing_name'];
  58      }
  59      $extras = array('order_type'=>$order_type,
  60      'order_name'=>$order_name,
  61      'product_count'=>$products->fields['count']);
  62      $accountHistory[] = array_merge($history->fields, $extras);
  63      $history->moveNext();
  64    }
  65  } else {
  66    $accountHasHistory = false;
  67  }
  68  // This should be last line of the script:

  69  $zco_notifier->notify('NOTIFY_HEADER_END_ACCOUNT_HISTORY');
  70  ?>


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