Make=$search_make Model=$search_model Zip=$search_zip
Request: ".print_r($_REQUEST, true)); die(); } if (!$search_page || !is_numeric($search_page)) { $search_page = 1; } if (!$search_sort) { $search_sort = 'distance'; } $cityst = Usenio::getCityStateForZip($search_zip); $city = $cityst['city']; $state = $cityst['state']; $makesraw = getMakeList(); $makes = array(); foreach ($makesraw as $m) { if ($m['is_popular']) { $makes[] = $m['make']; } } if ($search_make && $search_model) { $title = "Used {$search_make} {$search_model} For Sale in {$city}, {$state}"; $makesraw = getMakeList(); $modelsraw = getModelsForMake($search_make); $makes = array(); foreach ($makesraw as $m) { if ($m['is_popular']) { $makes[] = $m['make']; } } $models = array(); foreach ($modelsraw as $m) { if ($m['is_popular']) { $models[] = $m['model']; } } if (!in_array($search_make, $makes) || !in_array($search_model, $models) || empty($city) || empty($state)) { http_response_code(404); die(); } $breadcrumbs = array( array("href" => "/used", "text" => "Used Cars"), array("href" => "/used/{$search_make}_{$search_model}", "text" => "$search_make $search_model"), array("text" => "$city, $state", "attr" => "class=\"active\"")); $vehicles_by_city = getVehiclesByCity($search_make, $search_model, $search_zip); $similar = carCategory::getSimilarMakeModels(2017, $search_make, $search_model); $similar_mms = array(); foreach ($similar as $row) { $similar_mms[] = array($row['makeName'], $row['modelName']); } if (count($similar_mms) > 0) { $vehicles_by_mm = getVehiclesByMakeModel($similar_mms, $search_zip); } else { $vehicles_by_mm = null; error_log("Listings page: couldn't get similar makemodels for {$search_make} {$search_model}"); } $vehicles_by_make = getVehiclesByMake($search_make, $search_zip); } $listings_raw = listingsPageSearch($search_zip, $search_make, $search_model, $search_sort, $search_page); $listings = $listings_raw['results']; $total = $listings_raw['full_count']; $total_pages = ceil($total / 20.0); $raw_href = $_SERVER['REQUEST_URI']; $parsed = parse_url($raw_href); $query = parsed[PHP_URL_QUERY]; if (!empty($query)) { parse_str($query, $params); unset($params['page']); $new_params = http_build_query($params); } else { $new_params = null; } $page_href = $parsed[PHP_URL_PATH].($new_params ? "?".$new_params : null); if ($search_page > 1) { $prev_link = $page_href.($new_params ? "&" : "?")."page=".($search_page-1); } else { $prev_link = null; } if ($search_page < $total_pages) { $next_link = $page_href.($new_params ? "&" : "?")."page=".($search_page+1); } else { $next_link = null; } $total_rounded = floor($total / 10) * 10; if ($total_rounded >= 50) { $num_text = "Over $total_rounded"; } else { $num_text = "Search"; } $meta_description = "Get the best deal on a used {$search_make} {$search_model}. {$num_text} listings found near {$city}, {$state}. Compare prices from thousands of dealers and save!"; date_default_timezone_set('America/New_York'); $now = getdate(); $month = getMonthText(); $quoteText = randomQuote($search_make, $search_model); $quoteFnLn = randomFirstLast(); $quoteLoc = randomLocation(); include "new_layout.phtml";