Hi guys,
I assumed this would be easy, but am really struggling to find info in these forums...
I have "Apartments" stored as data objects:
class Apartment extends DataObject {
//db fields
static $db = array (
'Type' => 'Text',
'Title' => 'Varchar(255)',
'Price' => 'Text',
'Rooms' => 'Text',
'Bathrooms' => 'Text',
'Description' => 'Text',
'URLSegment' => 'Varchar(255)',
'OwnerName' => 'Varchar(255)',
'isActive' => 'Boolean',
);
Now I have a page that currently just lists all of the apartments in a nice template:
public function listAll ($filter = null){
if(!isset($_REQUEST['start'])) $_REQUEST['start'] = 0;
$filter = "isActive = '1'";
if(!$filter){ return false; } else
$limit = $_REQUEST['start'].",8";
$sort = 'Created ASC';
return DataObject::get('Apartment', $filter, $sort, null, $limit);
}
I'd just like to have the ability in the front end for users to filter the results by the attributes of each apartment, E.G - the apartment type, the price range, number of bedrooms etc.
I'm sure it's easy and I'm being a newb, but can somebody please help?
An exmaple form code would be amazing.
cheers!