I highly suggest creating a custom static search page to do this. It will take you a few extra minutes to set it up but will save you time in the long run because you won't have to edit the listing search and form editor functions.
It's actually really easy once you get the hang of it.
1) Inside your administration panel add the fields you wish to use into the Listing Template Editor. Be sure to make the fields searchable.
1) Open your listingsearch.php page - Example: http://www.rentomaha.com/listingsearch.php
2) View the page source and copy the search form. Copy all of your code from <form> to </form>.
3) Create a new search page, name it whatever you want. Example: search.php
Since the listingsearch.php form isn't formatted here's a clean search form template for you to use.
Code:
<form name="listingsearch" method="get" action="listing_browse.php">
<input type="hidden" name="type[]" value="Any Agent">
<table cellspacing="7" width="90%" align="center">
<tr>
<td><b>Area: </b></td>
<td align="left"><select name="Area[]">
<option></option>
<option>Downtown</option>
<option>Midtown</option>
</select> </td>
</tr>
<tr>
<td><b>Bedrooms: </b></td>
<td align="left"><select name="beds[]">
<option></option>
<option>Studio</option>
<option>1 Bed</option>
<option>2 Bed</option>
</select></td>
</tr>
<tr>
<td><b>Bathrooms: </b></td>
<td align="left"><select name="baths[]">
<option></option>
<option>1 Bath</option>
<option>2 Bath</option>
</select></td>
</tr>
<tr>
<td><b>Garage Available: </b></td>
<td align="left"><select name="garage_size[]">
<option></option>
<option>Yes</option>
<option>No</option>
</select></td>
</tr>
<tr>
<td align="center"><b>Home Features</b></td>
<td align="center"><b>Community Features</b></td>
</tr>
<tr>
<td align="center"><select multiple size="6" name="home_features[]">
<option>Feature 1</option>
<option>Feature 2</option>
</select></td>
<td align="center">
<select multiple size="6" name="community_features[]">
<option>Feature 1</option>
<option>Feature 2</option>
</select></td>
</tr>
<tr>
<td align="middle" colspan="2">
<input type="checkbox" value="yes" name="imagesOnly"> <b>Show only listings
with images</b> </td>
</tr>
<tr>
<td align="middle" colspan="2"><input type="submit" value="Search Now!"><form>
</form>
</td>
</tr>
</table>
4) Now look at your listingsearch.php source code and identify your search field names. Just copy the form field names and properties into the new page template I provided above. Make sure the name fields and types match.
Note 1 - If you are saving the page into a new directory instead of your document root make sure to change the form action to the correct location of your listingsearch.php page.
Note 2 - Notice in my example I have used a hidden input (<input type="hidden" name="type[]" value="Any Agent">). This is because I want the form to search all of the listings on the site. If you plan on providing listing searches by agent you will need to remove this field.
5) Save your new search page, upload it to your server, and call it from your browser. Example - http://www.rentomaha.com/search.php?type=apartments.
Note - on your search page remeber to include your config, hearder, and footer.
Example of the completed page: search.php
Code:
<?php
include("include/common.php");
include("$config[template_path]/user_top.html");
echo "
<form name="listingsearch" method="get" action="listing_browse.php">
<input type="hidden" name="type[]" value="Any Agent">
<table cellspacing="7" width="90%" align="center">
<tr>
<td><b>Area: </b></td>
<td align="left"><select name="Area[]">
<option></option>
<option>Downtown</option>
<option>Midtown</option>
</select> </td>
</tr>
<tr>
<td><b>Bedrooms: </b></td>
<td align="left"><select name="beds[]">
<option></option>
<option>Studio</option>
<option>1 Bed</option>
<option>2 Bed</option>
</select></td>
</tr>
<tr>
<td><b>Bathrooms: </b></td>
<td align="left"><select name="baths[]">
<option></option>
<option>1 Bath</option>
<option>2 Bath</option>
</select></td>
</tr>
<tr>
<td><b>Garage Available: </b></td>
<td align="left"><select name="garage_size[]">
<option></option>
<option>Yes</option>
<option>No</option>
</select></td>
</tr>
<tr>
<td align="center"><b>Home Features</b></td>
<td align="center"><b>Community Features</b></td>
</tr>
<tr>
<td align="center"><select multiple size="6" name="home_features[]">
<option>Feature 1</option>
<option>Feature 2</option>
</select></td>
<td align="center">
<select multiple size="6" name="community_features[]">
<option>Feature 1</option>
<option>Feature 2</option>
</select></td>
</tr>
<tr>
<td align="middle" colspan="2">
<input type="checkbox" value="yes" name="imagesOnly"> <b>Show only listings
with images</b> </td>
</tr>
<tr>
<td align="middle" colspan="2"><input type="submit" value="Search Now!"><form>
</form>
</td>
</tr>
</table>
";
include("$config[template_path]/user_bottom.html");
?>
I suggest saving the search form into an HTML file (search.html) and calling it into your search.php page. It makes editing the form much easier if you use an HTML editor such as FrontPage or Dreamweaver.
Example:
Code:
<?php
include("include/common.php");
include("$config[template_path]/user_top.html");
include("search.html");
include("$config[template_path]/user_bottom.html");
?>
Here's an example of our custom listing search: http://www.rentomaha.com/search.php
I hope that helps!
Bookmarks