Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Instant Website: Realty/Listings/Auto:
Search Results - Adv Search Result

 

 


Dominik
New User

Sep 15, 2009, 8:29 AM

Post #1 of 2 (1582 views)
Shortcut
Search Results - Adv Search Result Can't Post

Hello there,

i would like to add a 2nd property typ in one section is it possible?

because i have some flats, apartments & penthouse in the database.

I would like that the User can select in the Advantage Search only one selection like " Apartments" ( Url: http://www.mallorca-properties.co.uk/mallorca-properties.html )

and after click on the search button all properties are displayed ( Penthouse, Flats.+..Apartments)

That is the view code :

<select name="lfield14_keyword" id="lfield14_keyword">
<option value=""selected>All Properties</option>

<option value="Apartment">Apartments</option>

Can i chang it into?

<option value="Apartment, Flats, Penthouses">Apartments</option> ???

But these doesnt work ..do you have a good solution???

Thanks a lot and sorry for my bad englisch :-(


Chris
Staff


Sep 22, 2009, 1:49 PM

Post #2 of 2 (1527 views)
Shortcut
Re: [Dominik] Search Results - Adv Search Result [In reply to] Can't Post

Hi Dominik,

Unfortunately, this is a little tricky. You'll need to add some code to your search results page.

You probably have code like this already at the top of your search results page:


Code
  list($listingsRecords, $listingsMetaData) = getRecords(array( 
'tableName' => 'listings',
));


Replace that with the following:


Code
  $where = '1'; 
if (@$_REQUEST['lfield14_keyword']) {
$values = preg_split('|,\s*|', $_REQUEST['lfield14_keyword']);
unset($_REQUEST['lfield14_keyword']);
$orConditions = array();
foreach ($values as $value) {
$orConditions[] = "lfield14 LIKE '%" . mysql_escape($value) . "%'";
}
$where = '(' . join(' OR ', $orConditions) . ')';
}

list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'where' => $where,
));


Please note that you'll want to try this on a copy of that page so you don't break your live site if anything goes wrong.

I hope this helps. Please let me know if you run into any trouble or have any questions.
Chris