<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<?php

$modules_template = 'new_products_scroll';
if (!isset($ilosc_maksymalna) || $ilosc_maksymalna == 0) {
  $max_display = 1;
} else {
  $max_display = $ilosc_maksymalna;
}

//TotalB2B start
$new_products_query = tep_db_query("
      SELECT DISTINCT p.products_id,
                      p.products_quantity,
                      p.products_image,
                      p.products_tax_class_id,
                      p.products_retail_price,
                      p.products_price,
                      p.manufacturers_id,
                      pd.products_name,
                      p.products_date_added
                FROM (" . TABLE_PRODUCTS . " p
            LEFT JOIN " . TABLE_SPECIALS . " s using(products_id)),
                      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c,
                      " . TABLE_CATEGORIES . " c,
                      " . TABLE_PRODUCTS_DESCRIPTION . " pd
                WHERE p.products_status = '1' AND
                      c.categories_status='1' AND
                      p.products_id = p2c.products_id AND
                      pd.products_id = p.products_id AND
                      p2c.categories_id = c.categories_id AND
                      pd.language_id = '" . $languages_id . "' AND
                      DATE_SUB(CURDATE(),INTERVAL " . MAX_DISPLAY_TIME_NEW_PRODUCTS ." DAY) <= p.products_date_added
                      order by rand() desc limit " . $max_display
                      );

//TotalB2B end

$query_special_prices_hide_result = SPECIAL_PRICES_HIDE;
$special_hide = $query_special_prices_hide_result;

if (tep_db_num_rows($new_products_query) > 0) {
?>
<!-- new_products //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="templateinfoBox">
 <tr>
  <td class="main" style="padding-bottom:1px">
   <?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));
   new contentBoxHeading($info_box_contents);
   ?>
  </td>
 </tr>
 <tr>
  <td align="center" style="padding-bottom:5px">
   <table border="0" width="100%" cellspacing="0" cellpadding="1" class="TableFrame">
   <tr>
   <?php
   include (bts_select('modules', $modules_template));
   ?>
   </tr>
   </table>
  </td>
 </tr>
</table>

<?php
}
?>
<!-- new_products_eof //-->