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

<?php echo tep_draw_form('advanced_search', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get') . tep_hide_session_id(); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
      
 <!-- Naglowek BOF -->
 <tr>
  <td>
   <?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => sprintf(HEADING_TITLE_1));
   new contentBoxHeading($info_box_contents);
   ?>
  </td>
 </tr>
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
 </tr>
 <!-- Naglowek EOF -->

 <?php
 if ($messageStack->size('search') > 0) {
 ?>
 <tr>
  <td><?php echo $messageStack->output('search'); ?></td>
 </tr>
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
 </tr>
 <?php
 }
 ?>
 
 <tr>
  <td>
 		<fieldset>
		<legend><?php echo BOX_SEARCH_TEXT; ?></legend>
	  <table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
       <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
       </tr>
       <tr>
			  <td>
				 <table cellspacing="0" cellpadding="1" border="0" width="100%">
					<tr>
           <td class="fieldKey" width="20%"><b><?php echo BOX_SEARCH_TEXT; ?></b></td>
					 <td class="fieldValue" width="80%"><?php echo tep_draw_input_field('keywords', '', 'style="width: 99%"'); ?></td>
					</tr>
				 </table>
				</td>
       </tr>
       <tr>
        <td align="right" class="boxText"><?php echo tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION; ?></td>
       </tr>
       <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '1'); ?></td>
       </tr>
	</table>       
	</fieldset>
  </td>
 </tr>

 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
 </tr>
 
 <tr>
  <td>
 		<fieldset>
		<legend><?php echo HEADING_SEARCH_CRITERIA; ?></legend>
	  <table border="0" width="100%" cellspacing="0" cellpadding="2">
       <tr>
        <td class="fieldKey"><?php echo ENTRY_CATEGORIES; ?></td>
        <td class="fieldValue"><?php echo tep_draw_pull_down_menu('categories_id', tep_get_categories(array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)))); ?></td>
       </tr>
       <tr>
        <td class="fieldKey">&nbsp;</td>
        <td class="smallText"><?php echo tep_draw_checkbox_field('inc_subcat', '1', true) . ' ' . ENTRY_INCLUDE_SUBCATEGORIES; ?></td>
       </tr>
       <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
        <td class="fieldKey"><?php echo ENTRY_MANUFACTURERS; ?></td>
        <td class="fieldValue"><?php echo tep_draw_pull_down_menu('manufacturers_id', tep_get_manufacturers(array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)))); ?></td>
       </tr>
       <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
        <td class="fieldKey"><?php echo ENTRY_PRICE_FROM; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('pfrom'); ?></td>
       </tr>
       <tr>
        <td class="fieldKey"><?php echo ENTRY_PRICE_TO; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('pto'); ?></td>
       </tr>
       <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <tr>
        <td class="fieldKey"><?php echo ENTRY_DATE_FROM; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('dfrom', DOB_FORMAT_STRING, 'onFocus="RemoveFormatString(this, \'' . DOB_FORMAT_STRING . '\')"'); ?></td>
       </tr>
       <tr>
        <td class="fieldKey"><?php echo ENTRY_DATE_TO; ?></td>
        <td class="fieldValue"><?php echo tep_draw_input_field('dto', DOB_FORMAT_STRING, 'onFocus="RemoveFormatString(this, \'' . DOB_FORMAT_STRING . '\')"'); ?></td>
       </tr>
       <tr>
        <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
       </tr>
       <?php
              // ****************************************************************************************
              // ****************************************************************************************
              // This code has been added in order to make the attributes on products searchable by selecting
              // the attribute through a drop down list box, if you notice on your advanced_search.php page
              // that a select box is empty it means there are no option values for that option
              // Please leave these commented lines in this file.  This contribution was built by Adam,
              // If it helps you, then you can help me by donating through paypal, my email address is: adamsawchuk@hotmail.com
              $attributes_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "'");
              while ($attributes = tep_db_fetch_array($attributes_query)) {?>
                <tr>
                  <td class="fieldKey"><?php echo $attributes["products_options_name"]; ?></td>
                   <?php 
                   $option_values_query = tep_db_query('select pv.products_options_values_id as id, pv.products_options_values_name as text from ('. TABLE_PRODUCTS_OPTIONS_VALUES . ' pv, '. TABLE_PRODUCTS_OPTIONS .' po) join ' . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . ' popv on (pv.products_options_values_id = popv.products_options_values_id) where popv.products_options_id = po.products_options_id and popv.products_options_id =' . $attributes['products_options_id'] . ' and pv.language_id ='. (int)$languages_id . ' and po.language_id ='. (int)$languages_id .' group by pv.products_options_values_id, products_options_values_name');
                   $option_values_list = array(); //subzerostudio.com - bug fix                   

                   echo '<td class="fieldValue">';
                   $count = 0;
                   $option_values_list[$count] = array('id' => '', 'text' => '');
                   while ($option_values = tep_db_fetch_array($option_values_query)) {
                     $option_values_list[++$count] = $option_values;
                   }
                   echo tep_draw_pull_down_menu($attributes['products_options_id'], $option_values_list); ?>
                  </td>
                </tr><?php
              }
			        //// End of code added to advanced_search.php
			        /////////////////////////////////////////////
			        // ****************************************************************************************
			        // ****************************************************************************************
       ?>
      </table>
	</fieldset>
  </td>
 </tr>

 <!-- Przyciski BOF -->
 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
 </tr>
 <tr>
  <td>
      <table border="0" width="100%" cellspacing="0" cellpadding="2">
       <tr>
        <td>
         <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
           <td class="smallText" align="right"><?php echo tep_image_submit('button_search.gif', IMAGE_BUTTON_SEARCH); ?></td>
          </tr>
         </table>
        </td>
       </tr>
      </table>
  </td>
 </tr>
 <!-- Przyciski EOF -->
 

</table>
</form>