[ 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/product_info/ -> main_template_vars.php (source)

   1  <?php
   2  /**

   3   *  product_info main_template_vars.php

   4   *

   5   * @package productTypes

   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: main_template_vars.php 5369 2006-12-23 10:55:52Z drbyte $

  10   */
  11  /*

  12   * Extracts and constructs the data to be used in the product-type template tpl_TYPEHANDLER_info_display.php

  13   */
  14  
  15    // This should be first line of the script:

  16    $zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_START_PRODUCT_INFO');
  17  
  18    $module_show_categories = PRODUCT_INFO_CATEGORIES;
  19  
  20    $sql = "select count(*) as total
  21            from " . TABLE_PRODUCTS . " p, " .
  22                     TABLE_PRODUCTS_DESCRIPTION . " pd
  23            where    p.products_status = '1'
  24            and      p.products_id = '" . (int)$_GET['products_id'] . "'
  25            and      pd.products_id = p.products_id
  26            and      pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  27  
  28  
  29    $res = $db->Execute($sql);
  30  
  31    if ( $res->fields['total'] < 1 ) {
  32  
  33      $tpl_page_body = '/tpl_product_info_noproduct.php';
  34  
  35    } else {
  36  
  37      $tpl_page_body = '/tpl_product_info_display.php';
  38  
  39      $sql = "update " . TABLE_PRODUCTS_DESCRIPTION . "
  40              set        products_viewed = products_viewed+1
  41              where      products_id = '" . (int)$_GET['products_id'] . "'
  42              and        language_id = '" . (int)$_SESSION['languages_id'] . "'";
  43  
  44      $res = $db->Execute($sql);
  45  
  46      $sql = "select p.products_id, pd.products_name,
  47                    pd.products_description, p.products_model,
  48                    p.products_quantity, p.products_image,
  49                    pd.products_url, p.products_price,
  50                    p.products_tax_class_id, p.products_date_added,
  51                    p.products_date_available, p.manufacturers_id, p.products_quantity,
  52                    p.products_weight, p.products_priced_by_attribute, p.product_is_free,
  53                    p.products_qty_box_status,
  54                    p.products_quantity_order_max,
  55                    p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter
  56             from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
  57             where  p.products_status = '1'
  58             and    p.products_id = '" . (int)$_GET['products_id'] . "'
  59             and    pd.products_id = p.products_id
  60             and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
  61  
  62      $product_info = $db->Execute($sql);
  63  
  64      $products_price_sorter = $product_info->fields['products_price_sorter'];
  65  
  66      $products_price = $currencies->display_price($product_info->fields['products_price'],
  67                        zen_get_tax_rate($product_info->fields['products_tax_class_id']));
  68  
  69      $manufacturers_name= zen_get_products_manufacturers_name((int)$_GET['products_id']);
  70  
  71      if ($new_price = zen_get_products_special_price($product_info->fields['products_id'])) {
  72  
  73        $specials_price = $currencies->display_price($new_price,
  74                          zen_get_tax_rate($product_info->fields['products_tax_class_id']));
  75  
  76      }
  77  
  78  // set flag for attributes module usage:

  79      $flag_show_weight_attrib_for_this_prod_type = SHOW_PRODUCT_INFO_WEIGHT_ATTRIBUTES;
  80  // get attributes

  81      require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_ATTRIBUTES));
  82  
  83  // if review must be approved or disabled do not show review

  84      $review_status = " and r.status = '1'";
  85  
  86      $reviews_query = "select count(*) as count from " . TABLE_REVIEWS . " r, "
  87                                                         . TABLE_REVIEWS_DESCRIPTION . " rd
  88                         where r.products_id = '" . (int)$_GET['products_id'] . "'
  89                         and r.reviews_id = rd.reviews_id
  90                         and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'" .
  91                         $review_status;
  92  
  93      $reviews = $db->Execute($reviews_query);
  94  
  95    }
  96  
  97    require(DIR_WS_MODULES . zen_get_module_directory('product_prev_next.php'));
  98  
  99    $products_name = $product_info->fields['products_name'];
 100    $products_model = $product_info->fields['products_model'];
 101    $products_description = $product_info->fields['products_description'];
 102  
 103    if ($product_info->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
 104      $products_image = PRODUCTS_IMAGE_NO_IMAGE;
 105    } else {
 106      $products_image = $product_info->fields['products_image'];
 107    }
 108  
 109    $products_url = $product_info->fields['products_url'];
 110    $products_date_available = $product_info->fields['products_date_available'];
 111    $products_date_added = $product_info->fields['products_date_added'];
 112    $products_manufacturer = $manufacturers_name;
 113    $products_weight = $product_info->fields['products_weight'];
 114    $products_quantity = $product_info->fields['products_quantity'];
 115  
 116    $products_qty_box_status = $product_info->fields['products_qty_box_status'];
 117    $products_quantity_order_max = $product_info->fields['products_quantity_order_max'];
 118  
 119    $products_base_price = $currencies->display_price(zen_get_products_base_price((int)$_GET['products_id']),
 120                        zen_get_tax_rate($product_info->fields['products_tax_class_id']));
 121  
 122    $product_is_free = $product_info->fields['product_is_free'];
 123  
 124    $products_tax_class_id = $product_info->fields['products_tax_class_id'];
 125  
 126    $module_show_categories = PRODUCT_INFO_CATEGORIES;
 127    $module_next_previous = PRODUCT_INFO_PREVIOUS_NEXT;
 128  
 129    $products_id_current = (int)$_GET['products_id'];
 130    $products_discount_type = $product_info->fields['products_discount_type'];
 131    $products_discount_type_from = $product_info->fields['products_discount_type_from'];
 132  
 133  /**

 134   * Load product-type-specific main_template_vars

 135   */
 136    $prod_type_specific_vars_info = DIR_WS_MODULES . 'pages/' . $current_page_base . '/main_template_vars_product_type.php';
 137    if (file_exists($prod_type_specific_vars_info)) {
 138      include_once($prod_type_specific_vars_info);
 139    }
 140    $zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_PRODUCT_TYPE_VARS_PRODUCT_INFO');
 141  
 142  
 143  /**

 144   * Load all *.PHP files from the /includes/templates/MYTEMPLATE/PAGENAME/extra_main_template_vars

 145   */
 146    $extras_dir = $template->get_template_dir('.php', DIR_WS_TEMPLATE, $current_page_base . 'extra_main_template_vars', $current_page_base . '/' . 'extra_main_template_vars');
 147    if ($dir = @dir($extras_dir)) {
 148      while ($file = $dir->read()) {
 149        if (!is_dir($extras_dir . '/' . $file)) {
 150          if (preg_match('/\.php$/', $file) > 0) {
 151            $directory_array[] = '/' . $file;
 152          }
 153        }
 154      }
 155      $dir->close();
 156    }
 157    if (sizeof($directory_array)) sort($directory_array);
 158  
 159    for ($i = 0, $n = sizeof($directory_array); $i < $n; $i++) {
 160      if (file_exists($extras_dir . $directory_array[$i])) include($extras_dir . $directory_array[$i]);
 161    }
 162  
 163  // build show flags from product type layout settings

 164    $flag_show_product_info_starting_at = zen_get_show_product_switch($_GET['products_id'], 'starting_at');
 165    $flag_show_product_info_model = zen_get_show_product_switch($_GET['products_id'], 'model');
 166    $flag_show_product_info_weight = zen_get_show_product_switch($_GET['products_id'], 'weight');
 167    $flag_show_product_info_quantity = zen_get_show_product_switch($_GET['products_id'], 'quantity');
 168    $flag_show_product_info_manufacturer = zen_get_show_product_switch($_GET['products_id'], 'manufacturer');
 169    $flag_show_product_info_in_cart_qty = zen_get_show_product_switch($_GET['products_id'], 'in_cart_qty');
 170    $flag_show_product_info_tell_a_friend = zen_get_show_product_switch($_GET['products_id'], 'tell_a_friend');
 171    $flag_show_product_info_reviews = zen_get_show_product_switch($_GET['products_id'], 'reviews');
 172    $flag_show_product_info_reviews_count = zen_get_show_product_switch($_GET['products_id'], 'reviews_count');
 173    $flag_show_product_info_date_available = zen_get_show_product_switch($_GET['products_id'], 'date_available');
 174    $flag_show_product_info_date_added = zen_get_show_product_switch($_GET['products_id'], 'date_added');
 175    $flag_show_product_info_url = zen_get_show_product_switch($_GET['products_id'], 'url');
 176    $flag_show_product_info_additional_images = zen_get_show_product_switch($_GET['products_id'], 'additional_images');
 177    $flag_show_product_info_free_shipping = zen_get_show_product_switch($_GET['products_id'], 'always_free_shipping_image_switch');
 178    require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_PRODUCTS_QUANTITY_DISCOUNTS));
 179  
 180    $zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_EXTRA_PRODUCT_INFO');
 181  
 182  
 183    require($template->get_template_dir($tpl_page_body,DIR_WS_TEMPLATE, $current_page_base,'templates'). $tpl_page_body);
 184  
 185    //require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_ALSO_PURCHASED_PRODUCTS));

 186  
 187    // This should be last line of the script:

 188    $zco_notifier->notify('NOTIFY_MAIN_TEMPLATE_VARS_END_PRODUCT_INFO');
 189  ?>


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