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

   1  <?php
   2  /*
   3    $Id: product_reviews.php,v 1.50 2003/06/09 23:03:55 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    $product_info_query = tep_db_query("select p.products_id, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  16    if (!tep_db_num_rows($product_info_query)) {
  17      tep_redirect(tep_href_link(FILENAME_REVIEWS));
  18    } else {
  19      $product_info = tep_db_fetch_array($product_info_query);
  20    }
  21  
  22    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  23      $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>';
  24    } else {
  25      $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  26    }
  27  
  28    if (tep_not_null($product_info['products_model'])) {
  29      $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
  30    } else {
  31      $products_name = $product_info['products_name'];
  32    }
  33  
  34    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_REVIEWS);
  35  
  36    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()));
  37  ?>
  38  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  39  <html <?php echo HTML_PARAMS; ?>>
  40  <head>
  41  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  42  <title><?php echo TITLE; ?></title>
  43  <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
  44  <link rel="stylesheet" type="text/css" href="stylesheet.css">
  45  <script language="javascript"><!--
  46  function popupWindow(url) {
  47    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')
  48  }
  49  //--></script>
  50  </head>
  51  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
  52  <!-- header //-->
  53  <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  54  <!-- header_eof //-->
  55  
  56  <!-- body //-->
  57  <table border="0" width="100%" cellspacing="3" cellpadding="3">
  58    <tr>
  59      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
  60  <!-- left_navigation //-->
  61  <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  62  <!-- left_navigation_eof //-->
  63      </table></td>
  64  <!-- body_text //-->
  65      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  66        <tr>
  67          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  68            <tr>
  69              <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
  70              <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
  71            </tr>
  72          </table></td>
  73        </tr>
  74        <tr>
  75          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  76        </tr>
  77        <tr>
  78          <td><table width="100%" border="0" cellspacing="0" cellpadding="2">
  79            <tr>
  80              <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  81  <?php
  82    $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id desc";
  83    $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
  84  
  85    if ($reviews_split->number_of_rows > 0) {
  86      if ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')) {
  87  ?>
  88                <tr>
  89                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  90                    <tr>
  91                      <td class="smallText"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></td>
  92                      <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
  93                    </tr>
  94                  </table></td>
  95                </tr>
  96                <tr>
  97                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  98                </tr>
  99  <?php
 100      }
 101  
 102      $reviews_query = tep_db_query($reviews_split->sql_query);
 103      while ($reviews = tep_db_fetch_array($reviews_query)) {
 104  ?>
 105                <tr>
 106                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 107                    <tr>
 108                      <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $product_info['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '"><u><b>' . sprintf(TEXT_REVIEW_BY, tep_output_string_protected($reviews['customers_name'])) . '</b></u></a>'; ?></td>
 109                      <td class="smallText" align="right"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, tep_date_long($reviews['date_added'])); ?></td>
 110                    </tr>
 111                  </table></td>
 112                </tr>
 113                <tr>
 114                  <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
 115                    <tr class="infoBoxContents">
 116                      <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 117                        <tr>
 118                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 119                          <td valign="top" class="main"><?php echo tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>') . ((strlen($reviews['reviews_text']) >= 100) ? '..' : '') . '<br><br><i>' . sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_IMAGES . 'stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</i>'; ?></td>
 120                          <td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 121                        </tr>
 122                      </table></td>
 123                    </tr>
 124                  </table></td>
 125                </tr>
 126                <tr>
 127                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 128                </tr>
 129  <?php
 130      }
 131  ?>
 132  <?php
 133    } else {
 134  ?>
 135                <tr>
 136                  <td><?php new infoBox(array(array('text' => TEXT_NO_REVIEWS))); ?></td>
 137                </tr>
 138                <tr>
 139                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 140                </tr>
 141  <?php
 142    }
 143  
 144    if (($reviews_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
 145  ?>
 146                <tr>
 147                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 148                    <tr>
 149                      <td class="smallText"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></td>
 150                      <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info'))); ?></td>
 151                    </tr>
 152                  </table></td>
 153                </tr>
 154                <tr>
 155                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 156                </tr>
 157  <?php
 158    }
 159  ?>
 160                <tr>
 161                  <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
 162                    <tr class="infoBoxContents">
 163                      <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 164                        <tr>
 165                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 166                          <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params()) . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?></td>
 167                          <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()) . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>'; ?></td>
 168                          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
 169                        </tr>
 170                      </table></td>
 171                    </tr>
 172                  </table></td>
 173                </tr>
 174              </table></td>
 175              <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" align="right" valign="top"><table border="0" cellspacing="0" cellpadding="2">
 176                <tr>
 177                  <td align="center" class="smallText">
 178  <?php
 179    if (tep_not_null($product_info['products_image'])) {
 180  ?>
 181  <script language="javascript"><!--
 182  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>'; ?>');
 183  //--></script>
 184  <noscript>
 185  <?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>'; ?>
 186  </noscript>
 187  <?php
 188    }
 189  
 190    echo '<p><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now') . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></p>';
 191  ?>
 192                  </td>
 193                </tr>
 194              </table>
 195            </td>
 196          </table></td>
 197        </tr>
 198      </table></td>
 199  <!-- body_text_eof //-->
 200      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 201  <!-- right_navigation //-->
 202  <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 203  <!-- right_navigation_eof //-->
 204      </table></td>
 205    </tr>
 206  </table>
 207  <!-- body_eof //-->
 208  
 209  <!-- footer //-->
 210  <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
 211  <!-- footer_eof //-->
 212  <br>
 213  </body>
 214  </html>
 215  <?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