';
}
} else {
$viewHome .= 'Cannot Find Home/Model';
}
if ( isset($_POST['task']) && $_POST['task'] == md5('view') ){
echo $viewHome;
exit;
}
}
if ( isset($_POST['task']) && $_POST['task'] == md5('search') ){
/*/ LET MAKE SOME CONTENT
$select = "SELECT modelID, plotPrice, modelStyle, subName, modelLot, modelBlock, modelCity, "
. " (modelMain+modelUpper+modelLower) AS `modelSQFT`, "
. " modelBeds, modelBath, modelGarage, modelMLS, modelAddress, modelStatus "
. " FROM subDivisions AS s "
. " INNER JOIN plots AS p ON s.subID = p.subID "
. " INNER JOIN homes AS h ON ( s.subID = h.subID AND p.plotID = h.plotID ) "
. " WHERE s.status = 1 "
//. " AND (modelStatus = 4) "
. " AND ( soldDate = 0 )"
; // AND (plotStatus != 4 AND plotStatus != 5 ) // OR DATE_FORMAT(FROM_UNIXTIME(soldDate),'%Y') = DATE_FORMAT(NOW(),'%Y')
//. " AND (modelStatus != 4 AND modelStatus != 5 ) "; //*/
$select = "SELECT modelID, plotPrice, modelStyle, subName, modelLot, modelBlock, modelCity, "
. " (modelMain+modelUpper+modelLower) AS `modelSQFT`, "
. " modelBeds, modelBath, modelGarage, modelMLS, modelAddress, modelStatus "
. " FROM homes AS h "
. " INNER JOIN subDivisions AS s ON h.subID = s.subID "
. " INNER JOIN plots AS p ON (h.plotID = p.plotID AND h.subID = p.subID) "
. " WHERE s.status = 1 "
. " AND ( soldDate = 0 )";
// Ajax Response
$where = "";
if ( isset($_POST['task']) && $_POST['task'] == md5('search') ){
foreach( $searchDefaults as $field => $value){
if ( isset($_POST[$field]) && $_POST[$field] != $value ){
// Generically save search results
$_SESSION['search_homes'][$field] = $_POST[$field];
switch ($field) {
case 'searchPlotPrice_min':
if ($_POST['searchPlotPrice_min'] == $searchDefaults['searchPlotPrice_min'] ){
unset($_SESSION['search_homes'][$field]);// clear out default search, I know... super cheesy
$_POST['searchPlotPrice_min'] = '0.00';
}
$where .= " AND CAST(plotPrice AS DECIMAL(12,2)) >= '".mysql_real_escape_string(preg_replace('/[^-0-9|.]/i', '', $_POST[$field]))."' "; //preg_replace('/[^-0-9]/i', '', $_POST[$field]); // doubleval($_POST[$field])
break;
case 'searchPlotPrice_max':
if ($_POST['searchPlotPrice_max'] == $searchDefaults['searchPlotPrice_max'] ){
unset($_SESSION['search_homes'][$field]);// clear out default search, I know... super cheesy
$_POST['searchPlotPrice_max'] = '9999999999.99'; // SETUP THE DEFAULT SINCE THIS SYSTEM THINKS STRING = NUMBER
}
$where .= " AND CAST(plotPrice AS DECIMAL(12,2)) <= '".mysql_real_escape_string(preg_replace('/[^-0-9|.]/i', '', $_POST[$field]))."' ";
break;
case 'searchStyles':
$where .= " AND modelStyle LIKE '".mysql_real_escape_string($_POST[$field])."' ";
break;
case 'searchSubdivisions':
$where .= " AND s.subID = '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
case 'searchStatus':
$where .= " AND modelStatus = '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
case 'searchCity':
$where .= " AND modelCity LIKE '".mysql_real_escape_string($_POST[$field])."%' ";
break;
case 'searchLot':
$where .= " AND modelLot LIKE '".mysql_real_escape_string($_POST[$field])."%' ";
break;
case 'searchAddress':
$where .= " AND modelBlock LIKE '".mysql_real_escape_string($_POST[$field])."%' ";
break;
case 'searchBedrooms':
$where .= " AND modelBeds >= '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
case 'searchBathrooms':
$where .= " AND modelBath >= '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
case 'searchGarage':
$where .= " AND modelGarage >= '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
case 'searchSQFT':
$where .= " AND (modelMain+modelUpper+modelLower) >= '".mysql_real_escape_string((int)$_POST[$field])."' ";
break;
}
}
}
}
// Add Where
$select .= $where;
// Figure out GroupBy?
//$select .= " GROUP BY subName ";
// Figure out sort
$sortClass = '';
if ( isset($sort) && trim($sort) != '' ){
// Check sort and setup order by
switch($sort){
case 'plotPrice':
$select .= " ORDER BY CAST( REPLACE(REPLACE(plotPrice,'$',''),',','') AS DECIMAL(12,2)) ".mysql_real_escape_string($sortDir)." ";
break;
case 'modelLot':
default:
$select .= " ORDER BY `".mysql_real_escape_string($sort)."` ".mysql_real_escape_string($sortDir)." ";
break;
}
$sortClass = 'sort'.$sortDir;
$_SESSION['search_homes']['sort'] = $sort;
$_SESSION['search_homes']['sortDir'] = $sortDir;
} else {
$select .= " ORDER BY CAST( REPLACE(REPLACE(plotPrice,'$',''),',','') AS DECIMAL(12,2))";
$sort = 'plotPrice';
$sortDir = 'ASC';
$sortClass = 'sort'.$sortDir;
$_SESSION['search_homes']['sort'] = 'plotPrice';
$_SESSION['search_homes']['sortDir'] = 'ASC';
}
//echo $select;
$result = mysql_query($select) or die(mysql_error());
$outputTable = '';
if (mysql_num_rows($result) > 0 ){
// Setup headers
$outputTable .= '
'
. '
'
. '
PRICE
'
. '
STYLE
'
. '
SUBDIVISION
'
. '
LOT
'
. '
City
'
. '
SQFT
'
. '
BR
'
. '
BA
'
. '
GAR
'
. '
';
while ($row = mysql_fetch_assoc($result)){
// Find the files for this home -- For some rea
$homeImage = 'View';
$selectFiles = "SELECT fileName, fileType, fileText FROM homeFiles WHERE ownerID = '".mysql_real_escape_string($row['modelID'])."' AND fileType LIKE 'jpg'";
$resultFiles = mysql_query($selectFiles) or die('Cant find home files');
if (mysql_num_rows($resultFiles) > 0 ){
while($rowFiles = mysql_fetch_assoc($resultFiles)){
if ( file_exists($_SERVER['DOCUMENT_ROOT'].'/apps/models/large/'.$rowFiles['fileName']) ){
$homeImage = '';
break;
} else { $homeImage .= ' '; }
}
}
// Figure out what to display as the price, super cool fun time!
if ( $row['modelStatus'] == 3 ){ // SOLD
$priceListing = 'SOLD';
} else {
$priceListing = ( ( $row['plotPrice'] != '' ) ? '$'. number_format(preg_replace('/[^-0-9|.]/i', '', $row['plotPrice']),2) : ' N/A ' );
}
// lets try to get some output
$outputTable .= '
In today’s day and age, everything is visual – we invite you to look, see, touch and feel the difference in the homes we build at Bigelow Homes. Our model homes are designed to showcase the latest trends and features, and to showcase the benefits of the design, layout, and options available to you, our homebuyer.
We invite you to browse through each home online to help filter what you desire most in your next home. Next, explore all of the Bigelow homes for sale in Southeastern Minnesota in person by contacting any member of our team to set up a time convenient for you. Start your new home search today!