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

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 <!-- Naglowek BOF -->
 <tr>
  <td>
   <?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => sprintf(BOX_HEADING_MANUFACTURERS));
   new contentBoxHeading($info_box_contents);
   ?>
  </td>
 </tr>
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
 </tr>
 <!-- Naglowek EOF -->
 <tr>
  <td>

  <?php
  $ilosc_col = MAX_DISPLAY_CATEGORIES_PER_ROW;
  $ilosc_col = $ilosc_col - 1;
  $info_box_contents = array();
  $row = 0;
  $col = 0;
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';     // szerokosc tabeli zalezna od ilosci kolumn
  $szerokosc = SUBCATEGORY_IMAGE_WIDTH + 10;
  $wysokosc = SUBCATEGORY_IMAGE_WIDTH + 10;  
  $manufacturers_query = tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, m.manufacturers_image from " . TABLE_MANUFACTURERS . " m left join " . TABLE_PRODUCTS . " p on m.manufacturers_id = p.manufacturers_id left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and p.products_status = '1' order by m.manufacturers_name");
  if (tep_db_num_rows($manufacturers_query) > 0) {
  
      while ($mans = tep_db_fetch_array($manufacturers_query)) {
            $rows++;
            $info_box_contents[$row][$col] = array('align' => 'center',
                                                   'params' => 'class="smallText" width="'.$width.'" valign="top"',
                                                   'text' => '
            <table width="100%" cellpadding="5" cellspacing="0" class="TableFrame" style="height:100%">
              <tr>
                <td align="center" height="28" class="main">
                  <a class="ProductTile" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'. $mans['manufacturers_name'] . '</a>
                </td>
              </tr>
              <tr>
                <td align="center" valign="middle">'.
                ((isset($mans['manufacturers_image'])) ? tep_image(DIR_WS_IMAGES . $mans['manufacturers_image'], $mans['manufacturers_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT,'','','','',tep_href_link(FILENAME_DEFAULT, 'manufacturers_id='.$mans['manufacturers_id']),true) : '').'
                </td>
              </tr>
            </table>');
            $col ++;
            if ($col > $ilosc_col) {
              $col = 0;
              $row ++;
            }
      }
      new contentBox($info_box_contents);  
  }
  ?>
  </td>
 </tr>
</table>