Advertisement
Tsimi

xsell_products.php

Apr 20th, 2018
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.63 KB | None | 0 0
  1. <?php
  2. /*
  3. $Id
  4.  
  5. osCommerce, Open Source E-Commerce Solutions
  6. <http://www.oscommerce.com>
  7.  
  8. Copyright (c) 2018 osCommerce
  9.  
  10. Released under the GNU General Public License
  11. */
  12. //fixed bug
  13.  
  14. if ((USE_CACHE == 'true') && empty($SID)) {
  15.     // include currencies class and create an instance
  16.     require_once('includes/classes/currencies.php');
  17.     $currencies = new currencies();
  18. }
  19.  
  20. if ($_GET['products_id']) {
  21.  
  22.     $xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price
  23.     from products_xsell xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id
  24.     left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'
  25.     left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
  26.     where xp.products_id = '" . $_GET['products_id'] . "'
  27.     and p.products_status = '1'
  28.     order by sort_order asc limit " . MAX_DISPLAY_XSELL);
  29.  
  30. $num_products_xsell = tep_db_num_rows($xsell_query);
  31. if ($num_products_xsell > 0) {
  32. ?>
  33. <div class="col-sm-12">
  34.  
  35. <h3><?php echo TEXT_XSELL_PRODUCTS; ?></h3>
  36.   <div class="row list-group">
  37. <?php
  38. $position = 1;
  39.      while ($xsell = tep_db_fetch_array($xsell_query)) {
  40. ?>
  41.     <div class="col-sm-3">
  42.      <div class="thumbnail equal-height">
  43. <?php
  44.             if (tep_not_null($xsell['specials_new_products_price'])) {
  45.                 $xsell_price =  '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>';
  46.                 $xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';
  47.             } else {
  48.                 $xsell_price =  $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));
  49.             }
  50.  ?>  
  51. <?php
  52.             if ($xsell['image_display'] == 1) {
  53.                 echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('includes/languages/' . $language . '/images/' . 'no_picture.gif', TEXT_NO_PICTURE, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
  54.             } elseif (($xsell['image_display'] != 2) && tep_not_null($xsell['products_image'])) {
  55.                 echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . tep_image('images/'  . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
  56.             }
  57. ?>
  58.       <div class="caption">
  59.         <p class="text-center">
  60.             <?php echo '<a href="' . tep_href_link('product_info.php', 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a>'; ?>
  61.         </p>
  62.         <hr>
  63.           <p class="text-center">
  64.             <?php echo $xsell_price; ?>
  65.           </p>
  66.           <div class="text-center">
  67.             <div class="btn-group">
  68.               <a href="<?php echo tep_href_link('product_info.php', tep_get_all_get_params(array('action')) . 'products_id=' . $xsell['products_id']); ?>" class="btn btn-default" role="button"><?php echo SMALL_IMAGE_BUTTON_VIEW; ?></a>
  69.                <?php echo '<a href="' . tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=buy_now_xsell&products_id=' . (int)$xsell['products_id']) . '" class="btn btn-success btn-index btn-buy" role="button">' . SMALL_IMAGE_BUTTON_BUY . '</a>'; ?>            
  70.             </div>
  71.           </div>
  72.       </div>
  73.      </div>
  74.     </div>
  75.  <?php
  76.     $position++;
  77.        } //eof while
  78. ?>
  79.   </div>
  80. </div>
  81.  
  82. <?php
  83.      } // eof ($num_products_xsell > 0)
  84.    } // eof $_GET['products_id']
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement