Hi All, i hope someone can point me in the right direction, bit of a nOOb at this.
i have setup a little dealer area for my site and am trying to filter the results via 2 data fields but am not sure if i have even set it up right.
can any please point me in the right direction..
i want to be able to filter either or both `state` and `SearchCategory` i have set up a form hand coded that submits to the dealerHolder template but am not sure where to go next?
//// dealerHolder.php
<?php
class DealersHolder extends Page {
static $allowed_children = array( 'Dealers' );
}
class DealersHolder_Controller extends Page_Controller {
}
//// dealers.php
<?php
class Dealers extends Page {
static $allowed_children = array( 'DealerCarsHolder', 'DealerContact' );
static $default_child = 'DealerCarsHolder';
static $searchable_fields = array(
'State' => 'ExactMatchFilter',
'SearchCategory' => 'ExactMatchFilter'
);
public static $db = array(
'Street' => 'Varchar(255)',
'Suburb' => 'Varchar(150)',
'State' => "Varchar(40)",
'Postcode' => 'Varchar(100)',
'Phone' => 'Varchar(100)',
'Mobile' => 'Varchar(100)',
'Fax' => 'Varchar(100)',
'Url' => 'Varchar(255)',
'SearchCategory' => 'Varchar(255)'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('Street', _t('Partners.Street', 'Street Address'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Suburb', _t('Partners.Suburb', 'Suburb'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new DropdownField( 'State', 'State', array(
'VIC' => 'Victoria',
'NSW' => 'New South Wales',
'ACT' => 'Australian Capital Territory',
'QLD' => 'Queensland',
'NT' => 'Northern Territory',
'SA' => 'South Australia',
'WA' => 'Western Australia',
'TAS' => 'Tasmania',
)), 'Content');
$fields->addFieldToTab('Root.Content.Main', new NumericField('Postcode', _t('Partners.Postcode', 'Postcode'), '', 4),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Phone', _t('Partners.Phone', 'Phone ( please format like this (00) 0000-0000 )'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Mobile', _t('Partners.Mobile', 'Mobile ( please format like this 0000-000-000 )'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Fax', _t('Partners.Fax', 'Fax ( please format like this (00) 0000-0000 )'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Url', _t('Partners.Url', 'Url ( please include http://www. )'), ''),'Content');
$fields->addFieldToTab('Root.Content.Main', new DropdownField( 'SearchCategory', 'Searchable Category', array(
'dealerType1' => 'dealer Type 1',
'dealerType2' => 'dealer Type 2',
'dealerType3' => 'dealer Type 3',
'dealerType4' => 'dealer Type 4',
'dealerType5' => 'dealer Type 5'
)), 'Content');
return $fields;
}
}
class Partners_Controller extends Page_Controller {
}