<?php
/*
  osCommerce, Open Source E-Commerce Solutions 
http://www.oscommerce.com 

Copyright (c) 2003 osCommerce 

osCommRes, Services Oline 
http://www.oscommres.com 
Copyright (c) 2005 osCommRes 

Freeway eCommerce 
http://www.zac-ware.com/freeway 
Copyright (c) 2007 ZacWare 

Released under the GNU General Public License
*/
// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
?>
<!-- whats_new //-->
          <tr>
            <td>
<?php
	$customer_exists = '';
	if(tep_session_is_registered('customer_id'))
	$customer_exists = "OR(restrict_to_customers like '%," . $customer_id . ",%' OR restrict_to_groups like '%," . $customers_groups_id . ",%')";
	$random_sql = "select products_id, products_image_1,products_title_1, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' " . 
				" and (" . 
						"(restrict_to_customers = '' OR ISNULL(restrict_to_customers))" . 
						"and(restrict_to_groups = '' OR ISNULL(restrict_to_groups))" . $customer_exists . 
				") order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW;
	 if ($random_product = tep_random_select($random_sql)) {
    $random_product['products_name'] = stripslashes(tep_get_products_name($random_product['products_id']));
    $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

	if(!defined('BOX_HEADING_WHATS_NEW'))define('BOX_HEADING_WHATS_NEW', 'Latest products');
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left',
                                 'text'  => BOX_HEADING_WHATS_NEW 
                                );
   // new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW, '', 'NONSSL'));
   new infoBoxHeading($info_box_contents, true, true);

    if ($random_product['specials_new_products_price']) {
      $whats_new_price =  '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']),1,true) . '</s><br>';
      $whats_new_price .= $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) ;
    } else {
      $whats_new_price =  $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']),1,true);
    }

    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'center',
                                 'text'  => '<table border="0" cellspacing="2" cellpadding="5"><tr><td class="infoBoxNavigationContent" align="center" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_product_small_image($random_product['products_image_1'], stripslashes($random_product['products_title_1'])) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . $random_product['products_name'] . '</a><br><font class="productSpecialPrice">' . $whats_new_price . '</font></td></tr></table>'
                                );
    new infoBox($info_box_contents);
  }


$info_box_contents = array();
  $info_box_contents[] = array('align' => 'left',
                                'text'  => tep_draw_separator('pixel_trans.gif', '100%', '1')
                              );
  new infoboxFooter($info_box_contents, true, true);

?>
            </td>
          </tr>
<!-- whats_new_eof //-->
