  <?php
/*
  $Id: new_products.php,v 1.32 2002/04/26 20:28:07 dgw_ Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License
*/
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEW_PRODUCTS);
?>
<table width="398" border="0" cellpadding="0" cellspacing="0">
        <!--DWLayoutTable-->
        <tr>
          <TD width="17" height="20" valign="top"> <IMG SRC="images/title/template1_03.gif" WIDTH=17 HEIGHT=20 ALT=""></TD>
          <TD width="89" valign="top"> <IMG SRC="images/title/template1_04.gif" WIDTH=89 HEIGHT=20 ALT=""></TD>
          <TD width="292" valign="top" bgcolor="#305B77"><!--DWLayoutEmptyCell-->&nbsp;</TD>
        </tr>
        <tr>
          <TD height="7" COLSPAN=3 valign="top"> <IMG SRC="images/title/template1_07.gif" WIDTH=398 HEIGHT=7 ALT=""></TD>
        </tr>
      </table>







  <?php
  $info_box_contents = array();
  new contentBoxHeading($info_box_contents);
  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
    $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
  } else {
    $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
  }
  $info_box_contents = array();
  $row = 2;
  $col = 0;
  while ($new_products = tep_db_fetch_array($new_products_query)) {
    $new_products['products_name'] = tep_get_products_name($new_products['products_id']);
    $info_box_contents[$row][$col] = array('align' =>'<TABLE cellSpacing="0" cellPadding="0" border="0" valign="top">
                                <td width="145" align="center">
                                <TABLE cellSpacing="0" cellPadding="0" width="100%"
                                border="0" valign="top" align="center">
                                <TBODY>
                                <TR>
                                <TD vAlign="top" colSpan="3" height="31"></TD>
                                <TD width=100% class="featured" vAlign="middle" align="center">
                                <B><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"class="pagenavi">' . $new_products['products_name'] . '</a></B>
                                </TD>
                                </TR>
                                <TR>
                                <TD class="main" align="center"
                                colSpan="5"><IMG height="1"
                                src="images/test/pixel_trans(1).gif" alt=""
                                ',
                                'text' => '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'],100, 80) . '</a>
                                </TD>
                                </TR>
                                <TR>
                                <TD vAlign="top" colSpan="2"></TD><br>
                                <TD vAlign="top" colSpan="3" width=100%  align="center">
                                <a href=' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image_button('probox_11.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW) . '</a></TD>
                                <TD vAlign="top" colSpan="2"></TD></TR>
                                <TR></TABLE></td>');
    $col ++;
    if ($col > 2) {
      $col = 0;
      $row ++;
    }
  }
new newProductBox($info_box_contents);
?>
<!-- new_products_eof //-->