[ Index ]
 

Code source de osCommerce 2.2ms2-060817

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/catalog/includes/modules/ -> product_listing.php (source)

   1  <?php
   2  /*
   3    $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $
   4  
   5    osCommerce, Open Source E-Commerce Solutions
   6    http://www.oscommerce.com
   7  
   8    Copyright (c) 2003 osCommerce
   9  
  10    Released under the GNU General Public License
  11  */
  12  
  13    $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
  14  
  15    if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
  16  ?>
  17  <table border="0" width="100%" cellspacing="0" cellpadding="2">
  18    <tr>
  19      <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
  20      <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
  21    </tr>
  22  </table>
  23  <?php
  24    }
  25  
  26    $list_box_contents = array();
  27  
  28    for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
  29      switch ($column_list[$col]) {
  30        case 'PRODUCT_LIST_MODEL':
  31          $lc_text = TABLE_HEADING_MODEL;
  32          $lc_align = '';
  33          break;
  34        case 'PRODUCT_LIST_NAME':
  35          $lc_text = TABLE_HEADING_PRODUCTS;
  36          $lc_align = '';
  37          break;
  38        case 'PRODUCT_LIST_MANUFACTURER':
  39          $lc_text = TABLE_HEADING_MANUFACTURER;
  40          $lc_align = '';
  41          break;
  42        case 'PRODUCT_LIST_PRICE':
  43          $lc_text = TABLE_HEADING_PRICE;
  44          $lc_align = 'right';
  45          break;
  46        case 'PRODUCT_LIST_QUANTITY':
  47          $lc_text = TABLE_HEADING_QUANTITY;
  48          $lc_align = 'right';
  49          break;
  50        case 'PRODUCT_LIST_WEIGHT':
  51          $lc_text = TABLE_HEADING_WEIGHT;
  52          $lc_align = 'right';
  53          break;
  54        case 'PRODUCT_LIST_IMAGE':
  55          $lc_text = TABLE_HEADING_IMAGE;
  56          $lc_align = 'center';
  57          break;
  58        case 'PRODUCT_LIST_BUY_NOW':
  59          $lc_text = TABLE_HEADING_BUY_NOW;
  60          $lc_align = 'center';
  61          break;
  62      }
  63  
  64      if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
  65        $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
  66      }
  67  
  68      $list_box_contents[0][] = array('align' => $lc_align,
  69                                      'params' => 'class="productListing-heading"',
  70                                      'text' => '&nbsp;' . $lc_text . '&nbsp;');
  71    }
  72  
  73    if ($listing_split->number_of_rows > 0) {
  74      $rows = 0;
  75      $listing_query = tep_db_query($listing_split->sql_query);
  76      while ($listing = tep_db_fetch_array($listing_query)) {
  77        $rows++;
  78  
  79        if (($rows/2) == floor($rows/2)) {
  80          $list_box_contents[] = array('params' => 'class="productListing-even"');
  81        } else {
  82          $list_box_contents[] = array('params' => 'class="productListing-odd"');
  83        }
  84  
  85        $cur_row = sizeof($list_box_contents) - 1;
  86  
  87        for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
  88          $lc_align = '';
  89  
  90          switch ($column_list[$col]) {
  91            case 'PRODUCT_LIST_MODEL':
  92              $lc_align = '';
  93              $lc_text = '&nbsp;' . $listing['products_model'] . '&nbsp;';
  94              break;
  95            case 'PRODUCT_LIST_NAME':
  96              $lc_align = '';
  97              if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  98                $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
  99              } else {
 100                $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>&nbsp;';
 101              }
 102              break;
 103            case 'PRODUCT_LIST_MANUFACTURER':
 104              $lc_align = '';
 105              $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>&nbsp;';
 106              break;
 107            case 'PRODUCT_LIST_PRICE':
 108              $lc_align = 'right';
 109              if (tep_not_null($listing['specials_new_products_price'])) {
 110                $lc_text = '&nbsp;<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';
 111              } else {
 112                $lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '&nbsp;';
 113              }
 114              break;
 115            case 'PRODUCT_LIST_QUANTITY':
 116              $lc_align = 'right';
 117              $lc_text = '&nbsp;' . $listing['products_quantity'] . '&nbsp;';
 118              break;
 119            case 'PRODUCT_LIST_WEIGHT':
 120              $lc_align = 'right';
 121              $lc_text = '&nbsp;' . $listing['products_weight'] . '&nbsp;';
 122              break;
 123            case 'PRODUCT_LIST_IMAGE':
 124              $lc_align = 'center';
 125              if (isset($HTTP_GET_VARS['manufacturers_id'])) {
 126                $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
 127              } else {
 128                $lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>&nbsp;';
 129              }
 130              break;
 131            case 'PRODUCT_LIST_BUY_NOW':
 132              $lc_align = 'center';
 133              $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;';
 134              break;
 135          }
 136  
 137          $list_box_contents[$cur_row][] = array('align' => $lc_align,
 138                                                 'params' => 'class="productListing-data"',
 139                                                 'text'  => $lc_text);
 140        }
 141      }
 142  
 143      new productListingBox($list_box_contents);
 144    } else {
 145      $list_box_contents = array();
 146  
 147      $list_box_contents[0] = array('params' => 'class="productListing-odd"');
 148      $list_box_contents[0][] = array('params' => 'class="productListing-data"',
 149                                     'text' => TEXT_NO_PRODUCTS);
 150  
 151      new productListingBox($list_box_contents);
 152    }
 153  
 154    if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
 155  ?>
 156  <table border="0" width="100%" cellspacing="0" cellpadding="2">
 157    <tr>
 158      <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
 159      <td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 160    </tr>
 161  </table>
 162  <?php
 163    }
 164  ?>


Généré le : Mon Nov 26 19:48:25 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics