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

   1  <?php
   2  /*
   3    $Id: product_info.php,v 1.97 2003/07/01 14:34:54 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    require ('includes/application_top.php');
  14  
  15    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
  16  
  17    $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
  18    $product_check = tep_db_fetch_array($product_check_query);
  19  ?>
  20  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  21  <html <?php echo HTML_PARAMS; ?>>
  22  <head>
  23  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  24  <title><?php echo TITLE; ?></title>
  25  <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  26  <link rel="stylesheet" type="text/css" href="stylesheet.css">
  27  <script language="javascript"><!--
  28  function popupWindow(url) {
  29    window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
  30  }
  31  //--></script>
  32  </head>
  33  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  34  <!-- header //-->
  35  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  36  <!-- header_eof //-->
  37  
  38  <!-- body //-->
  39  <table border="0" width="100%" cellspacing="3" cellpadding="3">
  40    <tr>
  41      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  42  <!-- left_navigation //-->
  43  <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  44  <!-- left_navigation_eof //-->
  45      </table></td>
  46  <!-- body_text //-->
  47      <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
  48  <?php
  49    if ($product_check['total'] < 1) {
  50  ?>
  51        <tr>
  52          <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  53        </tr>
  54        <tr>
  55          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  56        </tr>
  57        <tr>
  58          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
  59            <tr class="infoBoxContents">
  60              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  61                <tr>
  62                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  63                  <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
  64                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
  65                </tr>
  66              </table></td>
  67            </tr>
  68          </table></td>
  69        </tr>
  70  <?php
  71    } else {
  72      $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
  73      $product_info = tep_db_fetch_array($product_info_query);
  74  
  75      tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
  76  
  77      if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  78        $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
  79      } else {
  80        $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  81      }
  82  
  83      if (tep_not_null($product_info['products_model'])) {
  84        $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
  85      } else {
  86        $products_name = $product_info['products_name'];
  87      }
  88  ?>
  89        <tr>
  90          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  91            <tr>
  92              <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
  93              <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
  94            </tr>
  95          </table></td>
  96        </tr>
  97        <tr>
  98          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  99        </tr>
 100        <tr>
 101          <td class="main">
 102  <?php
 103      if (tep_not_null($product_info['products_image'])) {
 104  ?>
 105            <table border="0" cellspacing="0" cellpadding="2" align="right">
 106              <tr>
 107                <td align="center" class="smallText">
 108  <script language="javascript"><!--
 109  document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
 110  //--></script>
 111  <noscript>
 112  <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
 113  </noscript>
 114                </td>
 115              </tr>
 116            </table>
 117  <?php
 118      }
 119  ?>
 120            <p><?php echo stripslashes($product_info['products_description']); ?></p>
 121  <?php
 122      $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
 123      $products_attributes = tep_db_fetch_array($products_attributes_query);
 124      if ($products_attributes['total'] > 0) {
 125  ?>
 126            <table border="0" cellspacing="0" cellpadding="2">
 127              <tr>
 128                <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
 129              </tr>
 130  <?php
 131        $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
 132        while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
 133          $products_options_array = array();
 134          $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
 135          while ($products_options = tep_db_fetch_array($products_options_query)) {
 136            $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
 137            if ($products_options['options_values_price'] != '0') {
 138              $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
 139            }
 140          }
 141  
 142          if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
 143            $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
 144          } else {
 145            $selected_attribute = false;
 146          }
 147  ?>
 148              <tr>
 149                <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
 150                <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
 151              </tr>
 152  <?php
 153        }
 154  ?>
 155            </table>
 156  <?php
 157      }
 158  ?>
 159          </td>
 160        </tr>
 161        <tr>
 162          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 163        </tr>
 164  <?php
 165      $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
 166      $reviews = tep_db_fetch_array($reviews_query);
 167      if ($reviews['count'] > 0) {
 168  ?>
 169        <tr>
 170          <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
 171        </tr>
 172        <tr>
 173          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 174        </tr>
 175  <?php
 176      }
 177  
 178      if (tep_not_null($product_info['products_url'])) {
 179  ?>
 180        <tr>
 181          <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
 182        </tr>
 183        <tr>
 184          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 185        </tr>
 186  <?php
 187      }
 188  
 189      if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 190  ?>
 191        <tr>
 192          <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
 193        </tr>
 194  <?php
 195      } else {
 196  ?>
 197        <tr>
 198          <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
 199        </tr>
 200  <?php
 201      }
 202  ?>
 203        <tr>
 204          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 205        </tr>
 206        <tr>
 207          <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
 208            <tr class="infoBoxContents">
 209              <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 210                <tr>
 211                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 212                  <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
 213                  <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
 214                  <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 215                </tr>
 216              </table></td>
 217            </tr>
 218          </table></td>
 219        </tr>
 220        <tr>
 221          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 222        </tr>
 223        <tr>
 224          <td>
 225  <?php
 226      if ((USE_CACHE == 'true') && empty($SID)) {
 227        echo tep_cache_also_purchased(3600);
 228      } else {
 229        include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
 230      }
 231    }
 232  ?>
 233          </td>
 234        </tr>
 235      </table></form></td>
 236  <!-- body_text_eof //-->
 237      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 238  <!-- right_navigation //-->
 239  <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 240  <!-- right_navigation_eof //-->
 241      </table></td>
 242    </tr>
 243  </table>
 244  <!-- body_eof //-->
 245  
 246  <!-- footer //-->
 247  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 248  <!-- footer_eof //-->
 249  <br>
 250  </body>
 251  </html>
 252  <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


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