Privilege Pre-Owned

Sale of new & pre-owned cars & commercial vehicles. Our showroom is currently located at The Grandstand @ Turf City, occupying over 5 lots of wide selection of vehicles for your viewing.

CONSIGN YOUR CAR WITH US - Located at one of Singapore’s main Car Marts – The GrandStand @ Turf City, Privilege Motors occupies over 5 lots with over 100 cars on display. On top of that, our large showroom frontage enables your car to be more visible and better presented to potential car buyers, especially for luxury models


ID); // $car_details_page = get_permalink($options['lne_sgcm_details_id']); $car_details_page = get_permalink($details_id); /* Default settings */ $xml_path = $options['lne_sgcm_listing_feed']; // live xml file on server // 1. allowed fields for sorting via querystring $arr_fields = array('model','price','reg_date','gear','eng_cap','veh_type','status'); $arr_order = array('asc','desc'); $arr_entries = array(10,25,50,100); // 2. used the following default values when invalid or missing inputs are used $uri['list_page'] = 1; $uri['search'] = ""; $uri['entries'] = 10; $uri['sort'] = ""; $uri['order'] = "asc"; // 3. Misc variables (do not need to change) $result = array(); $sort_column = array(); $default_sort_column_1 = array(); $default_sort_column_2 = array(); /* Validate all inputs and pagination requests */ if(isset($_GET['list_page'])){ if(!preg_match('/[^0-9]/',trim($_GET['list_page']))){ $uri['list_page'] = $_GET['list_page']; } } if(isset($_GET['search'])){ if(!preg_match('/[^a-zA-Z ]/',trim($_GET['search']))){ $uri['search'] = trim($_GET['search']); } } if(isset($_GET['entries'])){ if(array_search(trim($_GET['entries']),$arr_entries)!==false){ $uri['entries'] = trim($_GET['entries']); } } if(isset($_GET['sort'])){ if(array_search(trim($_GET['sort']),$arr_fields)!==false){ $uri['sort'] = trim($_GET['sort']); } } if(isset($_GET['order'])){ if(array_search(trim($_GET['order']),$arr_order)!==false){ $uri['order'] = trim($_GET['order']); } } /* Capture form submission */ // 1. from search if(isset($_POST['search_submitted'])){ if(trim($_POST['search-field'])!=""){ if(!preg_match('/[^a-zA-Z ]/',trim($_POST['search-field']))){ $uri['search'] = trim($_POST['search-field']); $uri['list_page'] = 1; // reset to page 1 } }else{ $uri['search'] = ''; } } // 2. from entries (top or bottom) if(isset($_POST['listing-length-1'])){ $uri['entries'] = trim($_POST['listing-length-1']); $uri['list_page'] = 1; // reset to page 1 } if($_POST['listing-length-2']){ $uri['entries'] = trim($_POST['listing-length-2']); $uri['list_page'] = 1; // reset to page 1 } /* Load XML file into array */ // 1. store values into array based on search filter $array = lne_sgcm_xml2array(file_get_contents($xml_path)); $total = sizeof($array['sgcarmart']['cars']['car']); foreach ($array as $sgcarmart) { foreach ($sgcarmart as $cars) { foreach ($cars as $car) { foreach ($car as $key => $attribute) { if($attribute['status'] == "Available"){ // comparing with search term if(preg_match('/'.$uri['search'].'/i',$attribute['model']) || $uri['search']==""){ // store filtered $result[] = $attribute; // default array column(s) for sorting, in order of priority $default_sort_column_1[$key] = $attribute['status']; $default_sort_column_2[$key] = $attribute['posted']; // selected array column for sorting if($uri['sort']) $sort_column[$key] = $attribute[$uri['sort']]; } } } } } } $total_filtered = sizeof($result); $total_filtered_pages = ceil($total_filtered/$uri['entries']); // 2. sort according to key (selected sort field) if($uri['sort']){ // use selected sorting if($uri['order']=="desc"){ array_multisort($sort_column, SORT_DESC, $result); }else{ array_multisort($sort_column, SORT_ASC, $result); } }else{ // use default prioritized sorting array_multisort($default_sort_column_1, SORT_ASC, $default_sort_column_2, SORT_DESC, $result); } // Generate table according to searched and paginated results $displayed_counter = 0; $counter = 1; $start = ($uri['list_page']-1)*$uri['entries']+1; $end = $uri['list_page']*$uri['entries']; $html_table .= ''; // 1. if sorted by a field, reflect change of class on table headers $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; foreach($result as $row){ // 2. only pull data from results that falls within range if($counter>=$start && $counter<=$end ){ if($counter % 2) { $html_table .= ''; } else { $html_table .= ''; } $html_table .= ''; $html_table .= ''; if($row['status']=='SOLD'){ $html_table .= ''; }else{ $html_table .= ''; } $html_table .= ''; $html_table .= ''; $html_table .= ''; $html_table .= ''; if($row['status']=='SOLD'){ $html_table .= ''; }else{ $html_table .= ''; } $html_table .= ''; if($counter % 2) { $html_table .= ''; } else { $html_table .= ''; } $html_table .= ''; $html_table .= ''; if($counter % 2) { $html_table .= ''; } else { $html_table .= ''; } $html_table .= ''; $html_table .= ''; $displayed_counter++; } $counter++; } if(!$displayed_counter){ $html_table .= ''; } $html_table .= '
 '.lne_sgcm_get_header_link($arr_fields[0],$uri,'Model',$this_page).''.lne_sgcm_get_header_link($arr_fields[1],$uri,'Price',$this_page).''.lne_sgcm_get_header_link($arr_fields[2],$uri,'Reg Date',$this_page).''.lne_sgcm_get_header_link($arr_fields[3],$uri,'Gear',$this_page).''.lne_sgcm_get_header_link($arr_fields[4],$uri,'Engine Cap',$this_page).''.lne_sgcm_get_header_link($arr_fields[5],$uri,'Type',$this_page).''.lne_sgcm_get_header_link($arr_fields[6],$uri,'Status',$this_page).'
'.$row['model'].' -- $'.number_format($row['price']).''.lne_sgcm_date_convert($row['reg_date'],'yyyy-mm-dd','dd-mm-yyyy').''.$row['gear'].''.$row['eng_cap'].''.$row['veh_type'].''.$row['status'].''.$row['status'].'
'; if(!empty($row['desc'])){ $html_table .= $row['desc']; }else{ $html_table .= " -- "; } $html_table .= '
Posted: '.lne_sgcm_date_convert($row['posted'],'yyyy-mm-dd','dd-mm-yyyy'); $html_table .= '     Updated: '.lne_sgcm_date_convert($row['updated'],'yyyy-mm-dd','dd-mm-yyyy').'
No records matched your criteria.
'; // Generate pagination string // 1. merge uri array to create new uri string $temp_uri['list_page'] = 'PAGE_NO'; $new_uri = array_merge($uri,$temp_uri); foreach($new_uri as $key => $value){ $str_uri .= $key.'='.$value.'&'; } $str_uri = substr($str_uri,0,-1); $temp_link = $this_page.'?'.$str_uri; // 2. first page $pagination['« First'] = 1; // 3. previous page if($uri['list_page']==1){ $pagination['‹ Prev'] = 1; }else{ $pagination['‹ Prev'] = $uri['list_page']-1; } // 4. all numbered pages if($total_filtered_pages < 5){ $temp_max_page = $total_filtered_pages; }else{ $temp_max_page = 5; } if($uri['list_page']<=3){ for($i=1;$i<=$temp_max_page;$i++){ $pagination[$i] = $i; } }elseif($uri['list_page']>=$total_filtered_pages-2){ for($i=$total_filtered_pages-4;$i<=$total_filtered_pages;$i++){ $pagination[$i] = $i; } }else{ for($i=$uri['list_page']-2;$i<=$uri['list_page']+2;$i++){ $pagination[$i] = $i; } } // 5. next page if($uri['list_page']==$total_filtered_pages){ $pagination['Next ›'] = $total_filtered_pages; }else{ $pagination['Next ›'] = $uri['list_page']+1; } // 6. last page $pagination['Last »'] = $total_filtered_pages; foreach($pagination as $key => $value){ $html_pagination .= ''.$key.' '; }else{ $html_pagination .= '">'.$key.' '; } } // Generate no. of entries drop down select $html_entries = 'Show      cars'; // Generate FORM ACTION path $str_uri = ''; foreach($uri as $key => $value){ $str_uri .= $key.'='.$value.'&'; } $str_uri = substr($str_uri,0,-1); global $post; $this_page = get_permalink($post->ID); $form_link = $this_page.'?'.$str_uri; // Persist Search Field $search_field = ''; if($uri['search']){ $search_field = $uri['search']; } // Generate Return HTML; $return_html = '

Available Cars

'; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= str_replace('X','1',$html_entries); $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= $html_pagination; $return_html .= '
'; $return_html .= ' '; $return_html .= '
'; $return_html .= $html_table; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= str_replace('X','2',$html_entries); $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= '
'; $return_html .= $html_pagination; $return_html .= '
'; $return_html .= '

Used car content from sgCarMart

'; $return_html .= '
'; echo $return_html; ?>