How to style a dropdown search form?

Hi,

I’m new to PHP and I’m working on installing a drop-down quick search form in my e-commerce site that searches by product attributes.

But I’m having some trouble figuring out how to style the forms.

There are three things that I’m hoping to achieve:

  1. Is there a way to style this form so that the width of the dropdown is extended to fill up most of the column? This should be relatively simple but I can’t seem to get the syntax right.

http://www.456bereastreet.com/lab/form_controls/select/

  1. Because of the way advanced_search_result.php works in osCommerce, a value has to be entered for a keyword everytime a search is done. This is not a big deal, but every time quick search is used, the search form that’s in the header of the site returns the number ‘1’. Is there a way to make this hidden completely?

3)And this may be a more complicated question separate from what else I’m asking, but is there a way to put the options names ‘Decibel’ and ‘Need’ into the form and maybe even written as ‘Sort by Decibel’ and ‘Sort by Need’? Actually in a perfect world I’d be able to select arrays as a range in the dropdown instead of exact attributes but that’s a different question I think.

Any help on any of these questions is greatly appreciated…Thanks

Nick

entirety of includes/boxes/attributes_dropdown.php:

<?php 
 
//return the setting options

// consists of: Shape 5, Type 1, Size 6, Material 7
//if a value has been selected, it will show as selected.

$opts = array( 1 => 'Decibel', 2 => 'Need');

// the number before the word represents the option ID in the `product_options` table
// the word after contains the displayed name of the dropdown box, which would usually be the same as the name

//title of the box

$heading = 'Quick Search';

// you should not need to edit below this line 
//------------------------

$mainhtml = ""; //the var to hold all of the html

foreach ( $opts as $opt => $name) {
	
	unset($html);
	
	$html = "<tr><td width='161px'>
				$name 
			</td></tr>
			<tr><td>
			<SELECT name='$opt' onchange='document.m_srch.submit();'>
			<OPTION value='not'>---</OPTION>";//print the name of the box and start the drop down
	
	$sql = "SELECT `products_options_values_id` from `products_options_values_to_products_options` WHERE `products_options_id`='$opt'"; 
	$res = tep_db_query($sql);// get the values of all the options for that catagory
	while($id = tep_db_fetch_array($res)){
	
		$optnamear = tep_db_query("SELECT `products_options_values_name` from `products_options_values` WHERE `products_options_values_id`='$id[products_options_values_id]'");
		
		$optname = tep_db_fetch_array($optnamear);
		
		//create the dropdown
		
		$html .= "<OPTION value='$id[products_options_values_id]' ";
		
		if($_GET[$opt] == $id['products_options_values_id']){
			$html .= "selected='selected'"; // if the product has already been selected keep it selected!
			} 
		
		$html .= ">$optname[products_options_values_name]</OPTION>";
		
		
		}
		
		$mainhtml .= $html."</SELECT></td></tr>";
		
		
	
	} 


echo "<tr><td>
<table border='0' width='100%' cellspacing='0' cellpadding='0'>
  <tr>
    <td height='14' class='infoBoxHeading'><img src='images/infobox/corner_left.gif' border='0' alt='' width='11' height='14'></td>
    <td  width='100%' height='14' class='infoBoxHeading' align='center'>$heading  </td>
	</tr>
	</table>
	<table border='0' width='100%' cellspacing='0' cellpadding='1' class='infoBox'>
			<tr><td>
			<table class='infoBoxContents'>
			<FORM name='m_srch' action='advanced_search_result.php' method='get'>
			<INPUT type='hidden' value='1' name='m_op'> <INPUT type='hidden' value='1' name='keywords'> \

			$mainhtml
			</table>
			</td></tr>
			</FORM>
		</table>
	</td></tr>";  

?> 

No1. Use the CSS width property on the Select element.

No2. Im not familiar with the classes your using but probably the easiest way to ‘hide’ the 1 is at the point of output. IE in the script that writes the header. just do a check of the value before writing and filter out if its just a ‘1’. It may be possible to treat this at source as well but without seeing all the scripts we wouldnt know if that would cause knock on effects elsewhere.

No3. Sorry didnt understand your question the names are displayed on your form arent they ??

Hi Mandes,

  1. That did work perfectly for me. I was putting the styling in the wrong line.

  2. Actually I was trying to put the description of each dropdown into the form instead of above it, but I now realize that can be done in the admin by creating an attribute with the title ‘Shop by Need’ or whatever and not assign it to a product.

  3. Hmm this is interesting info, but I really don’t know how to filter out the ‘1’. I’ve included all the code in case you might have any other insights. Thanks for the assistance! It’s been a big help.

at the bottom of the file:

<table border='0' width='100%' cellspacing='0' cellpadding='1' class='infoBox'>
			<tr><td>
			<table class='infoBoxContents'>
			<FORM name='m_srch' action='advanced_search_result.php' method='get'>
			<INPUT type='hidden' value='1' name='m_op'> <INPUT type='hidden' value='1' name='keywords'> \

			$mainhtml
			</table>
			</td></tr>
			</FORM>


.infoBoxContents {
  background: #ffffff;
  font-family: Verdana, Arial, sans-serif;
  font-size: 10px;
  border-spacing: 2px;
  border-collapse: separate;
  *border-collapse: expression('separate', cellSpacing = '2px');
}

And I hate to post an entire file, but here’s advanced_search_result.php:


 require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);

  $error = false;

  if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&
       (isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&
       (isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&
       (isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&
       (isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) ) {
    $error = true;

    $messageStack-&gt;add_session('search', ERROR_AT_LEAST_ONE_INPUT);
  } else {
    $dfrom = '';
    $dto = '';
    $pfrom = '';
    $pto = '';
    $keywords = '';

    if (isset($HTTP_GET_VARS['dfrom'])) {
      $dfrom = (($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dfrom']);
    }

    if (isset($HTTP_GET_VARS['dto'])) {
      $dto = (($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dto']);
    }

    if (isset($HTTP_GET_VARS['pfrom'])) {
      $pfrom = $HTTP_GET_VARS['pfrom'];
    }

    if (isset($HTTP_GET_VARS['pto'])) {
      $pto = $HTTP_GET_VARS['pto'];
    }

    if (isset($HTTP_GET_VARS['keywords'])) {
      $keywords = $HTTP_GET_VARS['keywords'];
    }

    $date_check_error = false;
    if (tep_not_null($dfrom)) {
      if (!tep_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {
        $error = true;
        $date_check_error = true;

        $messageStack-&gt;add_session('search', ERROR_INVALID_FROM_DATE);
      }
    }

    if (tep_not_null($dto)) {
      if (!tep_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {
        $error = true;
        $date_check_error = true;

        $messageStack-&gt;add_session('search', ERROR_INVALID_TO_DATE);
      }
    }

    if (($date_check_error == false) && tep_not_null($dfrom) && tep_not_null($dto)) {
      if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) &gt; mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {
        $error = true;

        $messageStack-&gt;add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);
      }
    }

    $price_check_error = false;
    if (tep_not_null($pfrom)) {
      if (!settype($pfrom, 'double')) {
        $error = true;
        $price_check_error = true;

        $messageStack-&gt;add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);
      }
    }

    if (tep_not_null($pto)) {
      if (!settype($pto, 'double')) {
        $error = true;
        $price_check_error = true;

        $messageStack-&gt;add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);
      }
    }

    if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {
      if ($pfrom &gt;= $pto) {
        $error = true;

        $messageStack-&gt;add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);
      }
    }

    if (tep_not_null($keywords)) {
      if (!tep_parse_search_string($keywords, $search_keywords)) {
        $error = true;

        $messageStack-&gt;add_session('search', ERROR_INVALID_KEYWORDS);
      }
    }
  }

  if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {
    $error = true;

    $messageStack-&gt;add_session('search', ERROR_AT_LEAST_ONE_INPUT);
  }

  if ($error == true) {
    tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
  }

  $breadcrumb-&gt;add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
  $breadcrumb-&gt;add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));
?&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html &lt;?php echo HTML_PARAMS; ?&gt;&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=&lt;?php echo CHARSET; ?&gt;"&gt;
&lt;base href="&lt;?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?&gt;"&gt;
&lt;title&gt;&lt;?php echo TITLE; ?&gt;&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="stylesheet.css"&gt;
&lt;link rel="stylesheet" type="text/css" href="jquerymegamenu.css" /&gt;

&lt;script type="text/javascript" src="jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="jquery.hoverIntent.minified.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt;

&lt;script type="text/javascript" charset="utf-8"&gt;
$(document).ready(function() {

	//function addMega(){
	//$(this).addClass("hovering");
	//}
	
	//function removeMega(){
	//$(this).removeClass("hovering");
	//}
	
	
	//function addMega(){
	//$(this).addClass("hovering");
	//$($(this).find("h2 a")).addClass("hover");
	//}
	
	//function removeMega(){
	//$(this).removeClass("hovering");
	//$($(this).find("h2 a")).removeClass("hover");
	//}
	
	
	function addMega(){
	$($(this).find("h2")).addClass("hover");
	$($(this).find("div.mega-choices")).slideDown("fast");
	$(this).addClass("hovering");
	}
	
	function removeMega(){
	$($(this).find("h2")).removeClass("hover");
	$($(this).find("div.mega-choices")).slideUp("fast");
	$(this).removeClass("hovering");
	} 
	
	var megaConfig = {
	interval: 30,
	sensitivity: 4,
	over: addMega,
	timeout: 100,
	out: removeMega
	};
	
	$("li.mega").hoverIntent(megaConfig)

});
&lt;/script&gt;
&lt;/head&gt;
&lt;body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"&gt;
&lt;!-- header //--&gt;
&lt;?php require(DIR_WS_INCLUDES . 'header.php'); ?&gt;
&lt;!-- header_eof //--&gt;
&lt;td&gt;&lt;?php echo tep_draw_separator('pixel_trans.gif', '100%', '12'); ?&gt;&lt;/td&gt;
&lt;!-- body //--&gt;
&lt;table border="0" width="100%" cellspacing="3" cellpadding="3"&gt;
  &lt;tr&gt;
    &lt;td width="&lt;?php echo BOX_WIDTH; ?&gt;" valign="top"&gt;&lt;table border="0" width="&lt;?php echo BOX_WIDTH; ?&gt;" cellspacing="0" cellpadding="2"&gt;
&lt;!-- left_navigation //--&gt;
&lt;?php require(DIR_WS_INCLUDES . 'column_left.php'); ?&gt;
&lt;!-- left_navigation_eof //--&gt;
    &lt;/table&gt;&lt;/td&gt;
&lt;!-- body_text //--&gt;
    &lt;td width="100%" valign="top"&gt;&lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;table border="0" width="100%" cellspacing="0" cellpadding="0"&gt;
          &lt;tr&gt;
            &lt;td class="pageHeading"&gt;&lt;?php echo HEADING_TITLE_2; ?&gt;&lt;/td&gt;
            &lt;td class="pageHeading" align="right"&gt;&lt;?php echo tep_image(DIR_WS_IMAGES . 'table_background_browse.gif', HEADING_TITLE_2, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;/table&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;
&lt;?php
// create column list
  $define_list = array('PRODUCT_LIST_MODEL' =&gt; PRODUCT_LIST_MODEL,
                       'PRODUCT_LIST_NAME' =&gt; PRODUCT_LIST_NAME,
                       'PRODUCT_LIST_MANUFACTURER' =&gt; PRODUCT_LIST_MANUFACTURER,
                       'PRODUCT_LIST_PRICE' =&gt; PRODUCT_LIST_PRICE,
                       'PRODUCT_LIST_QUANTITY' =&gt; PRODUCT_LIST_QUANTITY,
                       'PRODUCT_LIST_WEIGHT' =&gt; PRODUCT_LIST_WEIGHT,
                       'PRODUCT_LIST_IMAGE' =&gt; PRODUCT_LIST_IMAGE,
                       'PRODUCT_LIST_BUY_NOW' =&gt; PRODUCT_LIST_BUY_NOW);

  asort($define_list);

  $column_list = array();
  reset($define_list);
  while (list($key, $value) = each($define_list)) {
    if ($value &gt; 0) $column_list[] = $key;
  }

  $select_column_list = '';

  for ($i=0, $n=sizeof($column_list); $i&lt;$n; $i++) {
    switch ($column_list[$i]) {
      case 'PRODUCT_LIST_MODEL':
        $select_column_list .= 'p.products_model, ';
        break;
      case 'PRODUCT_LIST_MANUFACTURER':
        $select_column_list .= 'm.manufacturers_name, ';
        break;
      case 'PRODUCT_LIST_QUANTITY':
        $select_column_list .= 'p.products_quantity, ';
        break;
      case 'PRODUCT_LIST_IMAGE':
        $select_column_list .= 'p.products_image, ';
        break;
      case 'PRODUCT_LIST_WEIGHT':
        $select_column_list .= 'p.products_weight, ';
        break;
    }
  }
/** show-soldout-v1.0 **/
if(strpos($select_column_list, "p.products_quantity")==false)
$select_column_list .= 'p.products_quantity, ';
$select_column_list .= 'p.products_status, ';
/** end show-soldout-v1.0 **/
  $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price ";

  if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
    $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
  }

  $from_str = "from products_attributes AS atr, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id";

  if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
    if (!tep_session_is_registered('customer_country_id')) {
      $customer_country_id = STORE_COUNTRY;
      $customer_zone_id = STORE_ZONE;
    }
    $from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
  }

  $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";

if(isset($_GET['m_op'])){

	$str = array();
	$p_id = array();
	

	/* unset($_GET['not']);

	 foreach ($_GET as $k =&gt; $v)

		if(is_int($k) && ($v!="not")){

			$mk[]=$k;$mv[]=$v;

		}

	$and=" FIND_IN_SET(atr.options_id,'".implode(",",$mk)."') AND FIND_IN_SET(atr.options_values_id,'".implode(",",$mv)."') ";

//	 $and=substr($and,0,-3);

	 $ifs.=" p.products_id=atr.products_id AND (".$and.") AND";*/

	 foreach ($_GET as $k =&gt; $v){

		 if(is_int($k) && ($v!="not")){

			$str[]="[$k,$v]";

			$q=tep_db_query("SELECT `products_id`, `options_id`, `options_values_id` FROM `products_attributes` WHERE `options_id`='$k' AND `options_values_id`='$v'");

			while($res=tep_db_fetch_array($q)){

			$p_id[$res['products_id']].="[".$res['options_id'].",".$res['options_values_id']."]";

			/*echo"&lt;pre&gt;";

			print_r($res);

			echo"&lt;/pre&gt;";*/

			}

		}

	}

	foreach($str as $fstr)

		foreach($p_id as $k=&gt;$fp_id)

			if(strpos($fp_id,$fstr)===false)

				unset($p_id[$k]);

	foreach($p_id as $k=&gt;$v)

		$fr.=" atr.products_id='$k' OR";

	$fr=substr($fr,0,-2);

	if($fr!="")

		$ifs.=" p.products_id= atr.products_id AND ($fr) AND";

	else

		$ifs.="p.products_id=atr.products_id AND atr.products_id=0 AND";

//////

}

	

  $where_str = " where $ifs p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id ";


  if (isset($HTTP_GET_VARS['categories_id']) && tep_not_null($HTTP_GET_VARS['categories_id'])) {
    if (isset($HTTP_GET_VARS['inc_subcat']) && ($HTTP_GET_VARS['inc_subcat'] == '1')) {
      $subcategories_array = array();
      tep_get_subcategories($subcategories_array, $HTTP_GET_VARS['categories_id']);

      $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and (p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";

      for ($i=0, $n=sizeof($subcategories_array); $i&lt;$n; $i++ ) {
        $where_str .= " or p2c.categories_id = '" . (int)$subcategories_array[$i] . "'";
      }

      $where_str .= ")";
    } else {
      $where_str .= " and p2c.products_id = p.products_id and p2c.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";
    }
  }

  if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {
    $where_str .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }

  if (isset($search_keywords) && (sizeof($search_keywords) &gt; 0) &&(!isset($_GET['m_op']))) {
    $where_str .= " and (";
    for ($i=0, $n=sizeof($search_keywords); $i&lt;$n; $i++ ) {
      switch ($search_keywords[$i]) {
        case '(':
        case ')':
        case 'and':
        case 'or':
          $where_str .= " " . $search_keywords[$i] . " ";
          break;
        default:
          $keyword = tep_db_prepare_input($search_keywords[$i]);
          $where_str .= "(pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model like '%" . tep_db_input($keyword) . "%' or m.manufacturers_name like '%" . tep_db_input($keyword) . "%'";
          if (isset($HTTP_GET_VARS['search_in_description']) && ($HTTP_GET_VARS['search_in_description'] == '1')) $where_str .= " or pd.products_description like '%" . tep_db_input($keyword) . "%'";
          $where_str .= ')';
          break;
      }
    }
    $where_str .= " )";
  }

  if (tep_not_null($dfrom)) {
    $where_str .= " and p.products_date_added &gt;= '" . tep_date_raw($dfrom) . "'";
  }

  if (tep_not_null($dto)) {
    $where_str .= " and p.products_date_added &lt;= '" . tep_date_raw($dto) . "'";
  }

  if (tep_not_null($pfrom)) {
    if ($currencies-&gt;is_set($currency)) {
      $rate = $currencies-&gt;get_value($currency);

      $pfrom = $pfrom / $rate;
    }
  }

  if (tep_not_null($pto)) {
    if (isset($rate)) {
      $pto = $pto / $rate;
    }
  }

  if (DISPLAY_PRICE_WITH_TAX == 'true') {
    if ($pfrom &gt; 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) &gt;= " . (double)$pfrom . ")";
    if ($pto &gt; 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) * if(gz.geo_zone_id is null, 1, 1 + (tr.tax_rate / 100) ) &lt;= " . (double)$pto . ")";
  } else {
    if ($pfrom &gt; 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) &gt;= " . (double)$pfrom . ")";
    if ($pto &gt; 0) $where_str .= " and (IF(s.status, s.specials_new_products_price, p.products_price) &lt;= " . (double)$pto . ")";
  }

  if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
    $where_str .= " group by p.products_id, tr.tax_priority";
  }

  if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) &gt; sizeof($column_list)) ) {
    for ($i=0, $n=sizeof($column_list); $i&lt;$n; $i++) {
      if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
        $HTTP_GET_VARS['sort'] = $i+1 . 'a';
        $order_str = ' order by pd.products_name';
        break;
      }
    }
  } else {
    $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
    $sort_order = substr($HTTP_GET_VARS['sort'], 1);
    $order_str = ' order by ';
    switch ($column_list[$sort_col-1]) {
      case 'PRODUCT_LIST_MODEL':
        $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
      case 'PRODUCT_LIST_NAME':
        $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : "");
        break;
      case 'PRODUCT_LIST_MANUFACTURER':
        $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
      case 'PRODUCT_LIST_QUANTITY':
        $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
      case 'PRODUCT_LIST_IMAGE':
        $order_str .= "pd.products_name";
        break;
      case 'PRODUCT_LIST_WEIGHT':
        $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
      case 'PRODUCT_LIST_PRICE':
        $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name";
        break;
    }
  }

  $listing_sql = $select_str . $from_str . $where_str . $order_str;
  

  require(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td class="main"&gt;&lt;?php echo '&lt;a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(array('sort', 'page')), 'NONSSL', true, false) . '"&gt;' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '&lt;/a&gt;'; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;&lt;/td&gt;
&lt;!-- body_text_eof //--&gt;
    &lt;td width="&lt;?php echo BOX_WIDTH; ?&gt;" valign="top"&gt;&lt;table border="0" width="&lt;?php echo BOX_WIDTH; ?&gt;" cellspacing="0" cellpadding="2"&gt;
&lt;!-- right_navigation //--&gt;
&lt;?php require(DIR_WS_INCLUDES . 'column_right.php'); ?&gt;
&lt;!-- right_navigation_eof //--&gt;
    &lt;/table&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;!-- body_eof //--&gt;

&lt;!-- footer //--&gt;
&lt;?php require(DIR_WS_INCLUDES . 'footer.php'); ?&gt;
&lt;!-- footer_eof //--&gt;
&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?&gt;

you said that the ‘1’ was appearing in your header, so from the code above we need to see your header.php file

Actually what I had done is put a search form into a horizontal jquery menu which is in the header.

Here’s the relevant code from header.php:


	<li class="mega">
		<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get') . BOX_HEADING_SEARCH . tep_draw_input_field('keywords', '', 'value="Search..." onFocus="javascript:this.value=\\'\\'" size="15" maxlength="30" style="width: ' . (BOX_WIDTH-68) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '1') . tep_image_submit('button_search_icon.jpg', BOX_HEADING_SEARCH, 'align="middle"') . '</form>';?>
		</li>

And so what’s happening is when I use the quick search dropdowns in the left column, the number ‘1’ appears in the search form in the header.

this is a real longshot in the dark whilst blindfolded :confused:, but try changing that script for


 <li class="mega">
		<?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get') . BOX_HEADING_SEARCH . tep_draw_input_field('keywords', '', 'value="Search..." onFocus="javascript:this.value=\\'\\'" size="15" maxlength="30" style="width: ' . (BOX_WIDTH-68) . 'px"') . ' ' . tep_hide_session_id() . tep_draw_hidden_field('search_in_description' , '') . tep_image_submit('button_search_icon.jpg', BOX_HEADING_SEARCH, 'align="middle"') . '</form>';?>
		</li>

Remember to keep a copy of the original to put back if it doesnt work :wink:

Hi Mandes,

Unfortunately that didn’t remove the ‘1’. I’d share the link with you but this site is still offline. Is there a specific piece of code that you would need to see?

Thanks again for your help though.

Youre looking for the code that acually outputs the header info to the browser, your quick search seems to be setting a default value in the header search, since 1 wouldnt be a likely search if you can find it you may be able to skip that output when it equals 1.

Its a bodge fix, but the problem is finding the code which could be buried in layers of functions.

I’d already posted this snippet earlier from includes/boxes/attributes_dropdown.php, which is essentially the quick search box:


			<table class='infoBoxContents'>
			<FORM name='m_srch' action='advanced_search_result.php' method='get'>
			<INPUT type='hidden' value='1' name='m_op'> <INPUT type='hidden' value='1' name='keywords'> \

			$mainhtml
			</table>

I take it there’s no easy way to edit it at the source? Otherwise I’m guessing there are edits to make to advanced_search_result.php, bu this is definitely over my head at this point… Honestly it’s not a terribly big deal, and hopefully visitors won’t notice it too much.

Regards,

Nick