<?php
/*
  $Id: products_new.php,v 1.5 2007/05/07 06:51:47 ryu Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
  
  modified for Koshoten.net2
  http://www.koshoten.net/
*/
?>
<div id="productsNew">
<?php
  if (sizeof($products_new_array) < 1) {
?>
  <p class="noData"><?php echo TEXT_NO_NEW_PRODUCTS; ?></p>
<?php
  } else {
    for($i=0, $n=sizeof($products_new_array); $i<$n; $i++) {
      if ((KN_CFG_CONTACT_PRICE != 0) && ($products_new_array[$i]['price'] == KN_CFG_CONTACT_PRICE)) {
        if (defined("KN_CFG_CONTACT_BY_EMAIL") && (KN_CFG_CONTACT_BY_EMAIL == 'false')) {
          $products_price = KN_CFG_CONTACT_PRICE_TEXT;
        } else {
          $sjis_p_name = mb_convert_encoding($products_new_array[$i]['name'], "SJIS", "EUC-JP");
          $sjis_p_email_subject = mb_convert_encoding(KN_CFG_CONTACT_PRICE_EMAIL_SUBJECT, "SJIS", "EUC-JP");
          $sjis_p_email_body = mb_convert_encoding(KN_CFG_CONTACT_PRICE_EMAIL_BODY, "SJIS", "EUC-JP");
          $email_subject = rawurlencode($sjis_p_email_subject) . rawurlencode($sjis_p_name);
          $email_body = rawurlencode($sjis_p_email_body);
          $products_price = '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '?subject=' . $email_subject . '&body=' . $email_body . '">' . KN_CFG_CONTACT_PRICE_TEXT . '</a>';
        }
      } else {
        if (isset($products_new_array[$i]['specials_price'])) {
          $products_price = '<del>' .  $currencies->display_price($products_new_array[$i]['price'], tep_get_tax_rate($products_new_array[$i]['tax_class_id'])) . '</del>&nbsp;&nbsp;<span class="specialPrice">' . $currencies->display_price($products_new_array[$i]['specials_price'], tep_get_tax_rate($products_new_array[$i]['tax_class_id'])) . '</span>';
        } else {
          $products_price = $currencies->display_price($products_new_array[$i]['price'], tep_get_tax_rate($products_new_array[$i]['tax_class_id']));
        }
      }
      echo '<div class="productsNewBox">' . "\n";
      echo '<h4><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id']) . '"><span class="pName">' . $products_new_array[$i]['name'] . '</span></a>';
      echo (KN_CFG_USE_SUBTITLE == 'true' ? ' <span class="pSubtitle">' . $products_new_array[$i]['subtitle'] . '</span>' : '');
      echo (KN_CFG_USE_SERIES_TITLE == 'true' ? ' <span class="pSeriesTitle">' . $products_new_array[$i]['series_title'] . '</span>' : '');
      echo '</h4>' . "\n";
      if ($products_new_array[$i]['image']) {
        echo '<div width="' . SMALL_IMAGE_WIDTH . '" class="pImage"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new_array[$i]['id']) . '">' . 
               tep_image(DIR_WS_IMAGES . $products_new_array[$i]['image'], $products_new_array[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></div>' . "\n";
      }
      echo "<ul>\n";
      echo ((KN_CFG_USE_AUTHOR == 'true') && ($products_new_array[$i]['author']) ? '<li class="pAuthor">' . $products_new_array[$i]['author'] . "</li>\n" : '');
      echo ((KN_CFG_USE_PUBLISHERS == 'true') && ($products_new_array[$i]['publishers']) ? '<li class="pPublishers">' . $products_new_array[$i]['publishers'] . "</li>\n" : '');
      echo ((KN_CFG_USE_VOLUME == 'true') && ($products_new_array[$i]['volume']) ? '<li class="pVolume">' . $products_new_array[$i]['volume'] . "</li>\n" : '');
      echo ((KN_CFG_USE_PUBLISHED == 'true') && ($products_new_array[$i]['published']) ? '<li class="pPublished">' . $products_new_array[$i]['published'] . "</li>\n" : '');
      echo '<li class="pDescription">' . $products_new_array[$i]['description'] . "</li>\n";
      echo "</ul>\n";
      echo '<p class="pPrice">' . $products_price . '</p>' . "\n";
      if (!defined("KN_CFG_ALLOW_CHECKOUT") || (KN_CFG_ALLOW_CHECKOUT == "true")) {
        echo '<p class="buttonCart"><a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new_array[$i]['id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a></p>' . "\n";
      }
      echo '</div>' . "\n";
    }
  }
  if (($products_new_numrows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
<div class="listLink">
<p class="listCount"><?php echo $products_new_split->display_count($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></p>
<p class="listPrevNext"><?php echo TEXT_RESULT_PAGE; ?> <?php echo $products_new_split->display_links($products_new_numrows, MAX_DISPLAY_PRODUCTS_NEW, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></p>
</div>
<?php
  }
?>
</div>
