sn00ze
New Member
Hi all,
I'm trying to complete a custom search form.
I have been using {placeholders} and url filtering in a php form plugin... with some success, but have hit a wall with partially tricky SQL select involving a radius search.
It would be easiest if I could access and edit the SQL query that is generating my list?
Can this be done?
here is my code so far... and the search form (what's working so far..) can be seen here: http://glutenfreedietfinder.com.au/
I'm trying to complete a custom search form.
I have been using {placeholders} and url filtering in a php form plugin... with some success, but have hit a wall with partially tricky SQL select involving a radius search.
It would be easiest if I could access and edit the SQL query that is generating my list?
Can this be done?
here is my code so far... and the search form (what's working so far..) can be seen here: http://glutenfreedietfinder.com.au/
Code:
$app = JFactory::getApplication();
// build URL
$url = 'index.php?option=com_fabrik&view=list&listid=5&fabrikdebug=1&resetfilters=1';
// im_looking_for
$strTemp = '';
$strTemp = '{front_page_search___im_looking_for}';
if($strTemp !== ''){
$url .= '&fabrik_list_filter_all_5_com_fabrik_5=' . $strTemp;
}
// category
$strTemp = '';
$strTemp = '{front_page_search___category_raw}';
if($strTemp !== '00'){
$url .= '&new_entry___category=' . $strTemp;
}
// Speciality type
$strTemp = '';
$strTemp = '{front_page_search___specialty_type}';
if($strTemp !== ''){
$url .= '&new_entry___specialty_type=' . $strTemp;
}
// Radius search
preg_match('/([\d.-]+).+?([\d.-]+)/', $formModel->formData['front_page_search___location_Geocode'], $matches);
$lat = (float)$matches[1];
$long = (float)$matches[2];
//SELECT QUERY
//$query = $app->input->getInt( 'formid', 0 );
//$db = JFactory::getDbo();
//$query = $db->getQuery(false);
// debuggery
$app->enqueueMessage("lat: ". $lat . " long: " . $long ." Query: ". $query);
//var_dump($this->data);exit;
$app->redirect($url);