[ 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/templates/template_default/popup_attributes_qty_prices/ -> tpl_main_page.php (source)

   1  <?php
   2  /**

   3   * Override Template for common/tpl_main_page.php

   4   *

   5   * @package templateSystem

   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: tpl_main_page.php 2870 2006-01-21 21:36:02Z birdbrain $

  10   */
  11  ?>
  12  <body id="popupAtrribsQuantityPricesHelp">
  13  <table width="98%" border="2" cellpadding="2" cellspacing ="2" align="center" class="popupattributeqty">
  14    <tr>
  15      <td><table width="100%" border="0" cellpadding="2" cellspacing ="2" class="popupattributeqty">
  16        <tr>
  17          <td class="main" align="right"><?php echo '<a href="javascript:window.close()">' . TEXT_CURRENT_CLOSE_WINDOW . '</a>'; ?></td>
  18        </tr>
  19        <tr>
  20          <td class="pageHeading"><?php echo TEXT_ATTRIBUTES_QTY_PRICES_HELP ?></td>
  21        </tr>
  22        <tr>
  23          <td class="main">This is a paragraph of text in the window to see what it does to the size. The current size is pretty small and hard to read</td>
  24        </tr>
  25        <tr>
  26          <td>
  27  <?php
  28  $show_onetime= 'false';
  29  // attributes_qty_price

  30        if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
  31          $options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0")';
  32        } else {
  33          $options_order_by= ' order by popt.products_options_name';
  34        }
  35  
  36        $sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
  37                                popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_size
  38                from        " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
  39                where           patrib.products_id='" . (int)$_GET['products_id'] . "'
  40                and             patrib.options_id = popt.products_options_id
  41                and             popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
  42                $options_order_by;
  43  
  44        $products_options_names_lookup = $db->Execute($sql);
  45  
  46        while (!$products_options_names_lookup->EOF) {
  47  
  48          if ( PRODUCTS_OPTIONS_SORT_BY_PRICE =='1' ) {
  49            $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name';
  50          } else {
  51            $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price';
  52          }
  53  
  54          $sql = "select    pov.products_options_values_id,
  55                            pov.products_options_values_name,
  56                            pa.*
  57                  from      " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
  58                  where     pa.products_id = '" . (int)$_GET['products_id'] . "'
  59                  and       pa.options_id = '" . (int)$products_options_names_lookup->fields['products_options_id'] . "'
  60                  and       pa.options_values_id = pov.products_options_values_id
  61                  and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
  62                  $order_by;
  63  
  64          $products_options_lookup = $db->Execute($sql);
  65          $cnt_qty_prices= 0;
  66          while (!$products_options_lookup->EOF) {
  67            // set for attributes_qty_prices_onetime

  68            if ($products_options_lookup->fields['attributes_qty_prices_onetime'] != '') {
  69              $show_onetime= 'true';
  70            }
  71  
  72            if ($products_options_lookup->fields['attributes_qty_prices'] != '') {
  73              $attribute_quantity= '';
  74              $attribute_quantity_price= '';
  75              $attribute_table_cost = split("[:,]" , $products_options_lookup->fields['attributes_qty_prices']);
  76              $size = sizeof($attribute_table_cost);
  77              for ($i=0, $n=$size; $i<$n; $i+=2) {
  78  //                $attribute_quantity .= '<td align="center">' . (($i <= 1 and $attribute_table_cost[$i] != 1) ? '1-' . $attribute_table_cost[$i] : $attribute_table_cost[$i] . '+') . '</td>';

  79                  $zc_disp_qty = '';
  80                  switch (true) {
  81                    case ($i+2==$n):
  82                      $zc_disp_qty = $attribute_table_cost[$i-2]+1 . '+';
  83                      break;
  84                    case ($i <= 1 and $attribute_table_cost[$i] == 1):
  85                      $zc_disp_qty = '1';
  86                      break;
  87                    case ($i <= 1 and $attribute_table_cost[$i] != 1):
  88                      $zc_disp_qty = '1-' . $attribute_table_cost[$i];
  89                      break;
  90                    case ($i > 1 and $attribute_table_cost[$i-2]+1 != $attribute_table_cost[$i]):
  91                      $zc_disp_qty = $attribute_table_cost[$i-2]+1 . '-' . $attribute_table_cost[$i];
  92                      break;
  93                    case ($i > 1 and $attribute_table_cost[$i-2]+1 == $attribute_table_cost[$i]):
  94                      $zc_disp_qty = $attribute_table_cost[$i];
  95                      break;
  96                  }
  97  //                $attribute_quantity .= '<td align="center">' . (($i <= 1 and $attribute_table_cost[$i] != 1) ? '1-' . $attribute_table_cost[$i] : $attribute_table_cost[$i-2]+1 . '-' . $attribute_table_cost[$i]) . '</td>';

  98                  $attribute_quantity .= '<td align="center">' . $zc_disp_qty . '</td>';
  99                  $attribute_quantity_price .= '<td align="right">' . $currencies->display_price($attribute_table_cost[$i+1], zen_get_tax_rate($_GET['products_tax_class_id'])) . '</td>';
 100                  $cnt_qty_prices++;
 101              }
 102              echo '<table border="1" cellpadding="2" cellspacing="2">';
 103              echo '  <tr><td colspan="' . ($cnt_qty_prices + 1) . '">' . $products_options_names_lookup->fields['products_options_name'] . ' ' . $products_options_lookup->fields['products_options_values_name'] . '</td></tr>';
 104              echo '  <tr>';
 105              echo '    <td>' . TABLE_ATTRIBUTES_QTY_PRICE_QTY . '</td>' . $attribute_quantity;
 106              echo '  </tr>';
 107              echo '  <tr>';
 108              echo '    <td>' . TABLE_ATTRIBUTES_QTY_PRICE_PRICE . '</td>' . $attribute_quantity_price;
 109              echo '  </tr>';
 110              echo '</table>';
 111            }
 112            $products_options_lookup->MoveNext();
 113          }
 114            $products_options_names_lookup->MoveNext();
 115        }
 116  ?>
 117          </td>
 118        </tr>
 119  
 120  <?php
 121    if ($show_onetime == 'true') {
 122  ?>
 123  
 124        <tr>
 125          <td class="pageHeading"><?php echo TEXT_ATTRIBUTES_QTY_PRICES_ONETIME_HELP ?></td>
 126        </tr>
 127        <tr>
 128          <td>
 129  <?php
 130  // attributes_qty_price_onetime

 131        if (PRODUCTS_OPTIONS_SORT_ORDER=='0') {
 132          $options_order_by= ' order by LPAD(popt.products_options_sort_order,11,"0")';
 133        } else {
 134          $options_order_by= ' order by popt.products_options_name';
 135        }
 136  
 137        $sql = "select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
 138                                popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_size
 139                from        " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib
 140                where           patrib.products_id='" . (int)$_GET['products_id'] . "'
 141                and             patrib.options_id = popt.products_options_id
 142                and             popt.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
 143                $options_order_by;
 144  
 145        $products_options_names_lookup = $db->Execute($sql);
 146  
 147        while (!$products_options_names_lookup->EOF) {
 148  
 149          if ( PRODUCTS_OPTIONS_SORT_BY_PRICE =='1' ) {
 150            $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pov.products_options_values_name';
 151          } else {
 152            $order_by= ' order by LPAD(pa.products_options_sort_order,11,"0"), pa.options_values_price';
 153          }
 154  
 155          $sql = "select    pov.products_options_values_id,
 156                            pov.products_options_values_name,
 157                            pa.*
 158                  from      " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
 159                  where     pa.products_id = '" . (int)$_GET['products_id'] . "'
 160                  and       pa.options_id = '" . (int)$products_options_names_lookup->fields['products_options_id'] . "'
 161                  and       pa.options_values_id = pov.products_options_values_id
 162                  and       pov.language_id = '" . (int)$_SESSION['languages_id'] . "' " .
 163                  $order_by;
 164  
 165          $products_options_lookup = $db->Execute($sql);
 166          $cnt_qty_prices= 0;
 167          while (!$products_options_lookup->EOF) {
 168            if ($products_options_lookup->fields['attributes_qty_prices_onetime'] != '') {
 169              $attribute_quantity= '';
 170              $attribute_quantity_price= '';
 171              $attribute_table_cost = split("[:,]" , $products_options_lookup->fields['attributes_qty_prices_onetime']);
 172              $size = sizeof($attribute_table_cost);
 173              for ($i=0, $n=$size; $i<$n; $i+=2) {
 174                  $attribute_quantity .= '<td align="center">' . $attribute_table_cost[$i] . '</td>';
 175  //                $attribute_quantity_price .= '<td align="right">' . $attribute_table_cost[$i+1] . '</td>';

 176                  $attribute_quantity_price .= '<td align="right">' . $currencies->display_price($attribute_table_cost[$i+1], zen_get_tax_rate($_GET['products_tax_class_id'])) . '</td>';
 177                  $cnt_qty_prices++;
 178              }
 179              echo '<table border="1" cellpadding="2" cellspacing="2">';
 180              echo '  <tr><td colspan="' . ($cnt_qty_prices + 1) . '">' . $products_options_names_lookup->fields['products_options_name'] . ' ' . $products_options_lookup->fields['products_options_values_name'] . '</td></tr>';
 181              echo '  <tr>';
 182              echo '    <td>' . TABLE_ATTRIBUTES_QTY_PRICE_QTY . '</td>' . $attribute_quantity;
 183              echo '  </tr>';
 184              echo '  <tr>';
 185              echo '    <td>' . TABLE_ATTRIBUTES_QTY_PRICE_PRICE . '</td>' . $attribute_quantity_price;
 186              echo '  </tr>';
 187              echo '</table>';
 188            }
 189            $products_options_lookup->MoveNext();
 190          }
 191            $products_options_names_lookup->MoveNext();
 192        }
 193  
 194  ?>
 195          </td>
 196        </tr>
 197  <?php } // show onetime ?>

 198  
 199        <tr>
 200          <td class="main" align="right"><?php echo '<a href="javascript:window.close()">' . TEXT_CURRENT_CLOSE_WINDOW . '</a>'; ?></td>
 201        </tr>
 202      </table></td>
 203    </tr>
 204  </table>
 205  </body>


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