<?php
/**
 *\licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
 *\portion code Copyright (c) 2002 osCommerce
 *\package osCSS-2 <www http://www.oscss.org>
 *\version 2.1.0
 *\date  28/11/10, 08:18
 *\author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
 *\encode UTF-8
 *\group boxes
 *\file includes/boxes/featured.php
 */

  if ($random_product = tep_random_select("select p.products_id, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, pd.products_name
  from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'
  left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id
  left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
  where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS)) {

    ?>
    <div class="boxes">

      <h4 class="<?php echo $language ;?>"><?php echo BOX_HEADING_FEATURED ;?></h4>
      <?php echo tep_draw_form('featured', tep_href_link(BOX_HEADING_FEATURED, '', 'NONSSL', false), 'get') ; ?>
      <p>
        <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) ?>"><?php echo tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], $page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT')) ?></a>
        <br />
        <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) ?>"><?php echo $random_product['products_name'] ?></a>
        <br />
        <?php echo print_products_price_rv($random_product) ?>
      </p>
<?php } ?>

</div>