<?php
/*
  $Id: product_listing_col.php,v 1.3 2003/02/09 22:19:37 wilt Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2002 osCommerce

  Released under the GNU General Public License
*/
?>
<!-- product_listing_col //-->
<?php
  DEFINE('PRODUCT_LIST_COL_NUM',3);
  DEFINE('PRODUCT_LIST_COL_SHOW_CAT', true);
  $listing_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $listing_sql, $listing_numrows);
?>



<table width="400">
 <tr>
   <td class="smallText">&nbsp;<?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?>&nbsp;</td>
  <td align="right" class="smallText">&nbsp;<?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?>&nbsp;</td>
 </tr>
</table>
<TR>
           <TD class=main>
                    <TABLE cellSpacing=0 cellPadding=0 width=450 align=left
                        border=0>
                    <TBODY>
                    <TR>
                    <TD vAlign=top width=7 rowSpan=4></TD>
                    <TD vAlign=top width=495 colSpan=3 height=8></TD></TR>
                    <TR>
                    <TD vAlign=top width=5></TD>
                    <TD width=484>
                        <TABLE cellSpacing=0 cellPadding=2
                              width="100%" border=0 class="search">
                        <TBODY>
                        <TR>
                        <TD class=main>
                           <TABLE cellSpacing=0 cellPadding=2 border=0 width="100%">
                           <TBODY>

                           <TR>
                           <TD class=main>
<?php
  $info_box_contents = array();
  $row = 0;
  $col = 0;
  $listing = tep_db_query($listing_sql);
  while ($listing_values = tep_db_fetch_array($listing)) {
    $listing_values['products_name'] = tep_get_products_name($listing_values['products_id']);
    $lc_text= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a><br>';
    if ($listing_values['specials_new_products_price']) {
              $lc_text .= '&nbsp;<s>' .  $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing_values['specials_new_products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '</span>&nbsp;';
            } else {
              $lc_text .= '&nbsp;' . $currencies->display_price($listing_values['products_price'], tep_get_tax_rate($listing_values['products_tax_class_id'])) . '&nbsp;';
            }
    if (PRODUCT_LIST_BUY_NOW) {
      //$lc_text .= '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a>&nbsp;';
      $lc_text .= '<br><form name="buy_now_' . $listing_values['products_id'] . '" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $listing_values['products_id'] . '">' . tep_image_submit('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</form> ';

    }
    $info_box_contents[$row][$col] = array('align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',
                                           'text' => $lc_text);
    $col ++;
    if ($col > PRODUCT_LIST_COL_NUM-1) {
      $col = 0;
      $row ++;
    }
  }
  new productBox($info_box_contents);
?>
</TD>
</TR>
</TBODY></TABLE></TD></TR></TBODY></TABLE></TD>

                            <TD vAlign=top width=6></TD>
                        <TR>
                            <TD vAlign=top width=450 colSpan=3 height=18></TD></TR></TBODY></TABLE></TD></TR>
<table width="100%">
 <tr>
   <td class="smallText">&nbsp;<?php echo $listing_split->display_count($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?>&nbsp;</td>
  <td align="right" class="smallText">&nbsp;<?php echo TEXT_RESULT_PAGE; ?> <?php echo $listing_split->display_links($listing_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?>&nbsp;</td>
 </tr>

 <!-- product_listing_col //-->