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

$boxHeading = BOX_HEADING_WHATS_NEW_LAST_10;
$corner_left = 'rounded';
$corner_right = 'rounded';
$boxContent_attributes = ' align="center"';
$boxLink = '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW) . '">' .tep_image(DIR_WS_TEMPLATES . 'images/infobox/arrow_right.gif') .'</a>';
$box_base_name = 'whats_new_last_10';
$box_id = $box_base_name . 'Box'; 
$szerokosc = SMALL_IMAGE_WIDTH+10;
$wysokosc = SMALL_IMAGE_HEIGHT+10;

if (DISPLAY_PRICE_BRUTTO_NETTO == 'true') { $display_nb = 1; } else { $display_nb = 0; }
$query_special_prices_hide_result = SPECIAL_PRICES_HIDE;
$query_price_to_guest_result = ALLOW_GUEST_TO_SEE_PRICES;
$boxContent = '<div class="spec_kont">';

$news_prd_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_quantity, p.products_price, p.products_retail_price, p.products_tax_class_id, p.products_date_added, pd.products_name, pd.products_description, m.manufacturers_name from (" . TABLE_PRODUCTS . " p, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where c.categories_status='1' and TO_DAYS(NOW()) - TO_DAYS(p.products_date_added) < ".MAX_DISPLAY_TIME_NEW_PRODUCTS." and p.products_id = p2c.products_id and c.categories_id = p2c.categories_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC limit 10");
while ($news_prd = tep_db_fetch_array($news_prd_query)) {

  $news_prd['products_price'] = tep_xppp_getproductprice($news_prd['products_id']);
  $news_prd['specials_new_products_price'] = tep_get_products_special_price($news_prd['products_id']);

  if ($news_prd['products_image'] != ''){
    $boxContent .= '<div class="spec_img" style="padding-top:10px">';  
    $boxContent .= tep_image(DIR_WS_IMAGES . $news_prd['products_image'], $news_prd['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,'',$wysokosc,$szerokosc,$news_prd['products_id'],tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $news_prd['products_id']),true);
    $boxContent .= '</div>';
  }

  $boxContent .= '<div class="spec_text">';
  if ($news_prd['products_price'] > 0) {
      if ($query_special_prices_hide_result == 'true') {
        $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $news_prd['products_id']) . '">' . osc_trunc_string($news_prd['products_name'], 50, 1) . '</a><br><span class="Cena">' . $currencies->display_price($news_prd['products_id'], $news_prd['products_price'], tep_get_tax_rate($news_prd['products_tax_class_id']),1,$display_nb) . '</span>';
      } else {
        if ((($query_price_to_guest_result=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {
          if ($news_prd['specials_new_products_price'] > 0) {
             $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $news_prd['products_id']) . '">' . osc_trunc_string($news_prd['products_name'], 50, 1) . '</a><br><span class="boxText"><s>' . $currencies->display_price($news_prd['products_id'], $news_prd['products_price'], tep_get_tax_rate($news_prd['products_tax_class_id'])) . '</s></span><br><span class="productSpecialPrice">' . $currencies->display_price_nodiscount($news_prd['products_id'], $news_prd['specials_new_products_price'], tep_get_tax_rate($news_prd['products_tax_class_id']),1,$display_nb) . '</span>';
             } else {
             $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $news_prd['products_id']) . '">' . osc_trunc_string($news_prd['products_name'], 50, 1) . '</a><br><span class="Cena">' . $currencies->display_price($news_prd['products_id'], $news_prd['products_price'], tep_get_tax_rate($news_prd['products_tax_class_id']),1,$display_nb) . '</span>';
          }
        } else {
          $boxContent .= '<a class="boxLink" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $news_prd['products_id']) . '">' . osc_trunc_string($news_prd['products_name'], 50 ,1) . '</a><br><span class="boxText"><b>' .PRICES_LOGGED_IN_TEXT. '</b></span>';
        }
     }
  } else {
    $boxContent .= '<span class="boxText"><b>' .TEMPORARY_NO_PRICE. '</b></span>';
 }        
 $boxContent .= '</div>';
}

$boxContent .= '</div>';  
include (bts_select('boxes', $box_base_name)); // BTS 1.5

$boxLink = '';
$boxContent_attributes = '';

?>