assign('defaultLocation',$defaultLocation); $smarty->assign('location',$defaultLocation); $locations=$geo->getChildGeo($defaultLocation->id); $smarty->assign('locations',$locations); // $getStoreCount=16; /*設置查詢條件 start*/ $autoid=intval($_REQUEST['autoid']); //cfs select $cacheCode=new cacheCode(); $cfsSelects=$cacheCode->autoCfsSelect(); $cfsSelects=str_replace('span id="g4cfsSpan"','span id="g4cfsSpan" style="display:none"',$cfsSelects);//無需顯示最后一級select $smarty->assign('cfsSelect',$cfsSelects); if ($autoid){//已選擇的車型select信息,隱藏輸出到頁面上,然后通過js來顯示select $autoCf=new autoClassification(); $cfsSelectInfo=$cacheCode->autoCfsSelectValues($autoid);//已選擇的車型select信息,隱藏輸出到頁面上,然后通過js來顯示select $smarty->assign('cfsSelectInfo',$cfsSelectInfo); } // $smarty->assign('bodyStructs',$bodyStructs); $smarty->assign('gearboxs',$gearboxs); $smarty->assign('colors',$colors); /*設置查詢條件 end*/ //ext if (file_exists(ABS_PATH.'/extension/'.AUTO_SKIN.'/'.UCAR_DIR.'/index.php')){ include_once(ABS_PATH.'/extension/'.AUTO_SKIN.'/'.UCAR_DIR.'/index.php'); } /*獲取二手車列表--開始*/ //篩選條件 $conditions=array( array('col'=>'checked','compare'=>'=','value'=>1,'valuetype'=>'int'), array('col'=>'validtime','compare'=>'>','value'=>$now,'valuetype'=>'int'), array('col'=>'inputfinish','compare'=>'=','value'=>1,'valuetype'=>'int') ); //根據查詢條件重組篩選條件 $geoid=isset($_REQUEST['geoid'])?intval($_REQUEST['geoid']):0; $smarty->assign('geoid',$geoid); if ($geoid){ $thisLocation=$geo->getGeoByID($geoid); $smarty->assign('location',$thisLocation); $childGeos=$geo->getChildGeo($geoid); if ($childGeos){ $geoidStr=$geoid; foreach ($childGeos as $g){ $geoidStr.='|'.$g->id; } array_push($conditions,array('col'=>'geoid','value'=>$geoidStr,'compare'=>'=','ao'=>'OR','valuetype'=>'string')); }else { array_push($conditions,array('col'=>'geoid','value'=>$geoid,'compare'=>'=','valuetype'=>'int')); } }else { $thisLocation=$geo->getDefaultChildLocation(); } if ($autoid){//autoid if (intval($thisAutoCf->grade)==3){ array_push($conditions,array('col'=>'parentautoid','value'=>$autoid,'compare'=>'=','valuetype'=>'int')); }else { //該品牌下都有哪些第三級車型 $g3autos=$autoCf->getGrade3Cfs($autoid,UCAR_GROUP); $g3autoStr=''; if ($g3autos){ $g3autoStrPrifix=''; foreach ($g3autos as $g3auto){ $g3autoStr.=$g3autoStrPrifix.$g3auto->id; $g3autoStrPrifix='|'; } } array_push($conditions,array('col'=>'parentautoid','value'=>$g3autoStr,'compare'=>'=','ao'=>'OR','valuetype'=>'string')); } } if (isset($_REQUEST['autoname'])&&strlen($_REQUEST['autoname'])){//autoname $autoname=$_REQUEST['autoname']; if (get_magic_quotes_gpc()){ $autoname=stripslashes($autoname); } $autoname=htmlspecialchars(mysql_real_escape_string($autoname)); $smarty->assign('autoname',$autoname); array_push($conditions,array('col'=>'autoname','value'=>$autoname,'compare'=>'like','valuetype'=>'string')); } if (isset($_REQUEST['bodystruct'])&&strlen($_REQUEST['bodystruct'])){//bodystruct $bds=explode('|',$_REQUEST['bodystruct']); $bodystruct=$_REQUEST['bodystruct']; if (get_magic_quotes_gpc()){ $bodystruct=stripslashes($bodystruct); } $bodystruct=htmlspecialchars(mysql_real_escape_string($bodystruct)); $smarty->assign('bodystruct',$bodystruct); array_walk($bds,'int'); if (count($bds)>1){ array_push($conditions,array('col'=>'bodystruct','value'=>$_REQUEST['bodystruct'],'compare'=>'=','ao'=>'OR','valuetype'=>'string')); }else{ array_push($conditions,array('col'=>'bodystruct','value'=>$_REQUEST['bodystruct'],'compare'=>'=','valuetype'=>'string')); } } if (isset($_REQUEST['lowprice'])&&strlen($_REQUEST['lowprice'])){//lowprice $smarty->assign('lowprice',floatval($_GET['lowprice'])); array_push($conditions,array('col'=>'price','value'=>$_REQUEST['lowprice'],'compare'=>'>','valuetype'=>'float')); } if (isset($_REQUEST['highprice'])&&strlen($_REQUEST['highprice'])){//highprice $smarty->assign('highprice',floatval($_GET['highprice'])); array_push($conditions,array('col'=>'price','value'=>$_REQUEST['highprice'],'compare'=>'<','valuetype'=>'float')); } //age $thisYear=date('Y',$now); if (isset($_REQUEST['lowage'])&&intval($_REQUEST['lowage'])){//lowage $lowAge=intval($_REQUEST['lowage']); $lowYear=$thisYear-$lowAge-1;//包括填入值 $smarty->assign('lowage',intval($_GET['lowage'])); array_push($conditions,array('col'=>'registeyear','value'=>$lowYear,'compare'=>'>','valuetype'=>'int')); } if (isset($_REQUEST['highage'])&&intval($_REQUEST['highage'])){//lowage $highAge=intval($_REQUEST['highage']); $highYear=$thisYear+$highAge+1;//包括填入值 $smarty->assign('highage',$highAge); array_push($conditions,array('col'=>'registeyear','value'=>$highYear,'compare'=>'<','valuetype'=>'int')); } if (isset($_REQUEST['lowmileage'])&&strlen($_REQUEST['lowmileage'])){//lowmileage $smarty->assign('lowmileage',intval($_GET['lowmileage'])); array_push($conditions,array('col'=>'mileage','value'=>$_REQUEST['lowmileage'],'compare'=>'>','valuetype'=>'float')); } if (isset($_REQUEST['highmileage'])&&strlen($_REQUEST['highmileage'])){//highmileage $smarty->assign('highmileage',intval($_GET['highmileage'])); array_push($conditions,array('col'=>'mileage','value'=>$_REQUEST['highmileage'],'compare'=>'<','valuetype'=>'float')); } if (isset($_REQUEST['gearbox'])&&intval($_REQUEST['gearbox'])){//gearbox $smarty->assign('gearbox',intval($_GET['gearbox'])); array_push($conditions,array('col'=>'gearbox','value'=>$_REQUEST['gearbox'],'compare'=>'=','valuetype'=>'int')); } if (isset($_REQUEST['lowdisplacement'])&&strlen($_REQUEST['lowdisplacement'])){//lowdisplacement $smarty->assign('lowdisplacement',floatval($_GET['lowdisplacement'])); array_push($conditions,array('col'=>'displacement','value'=>$_REQUEST['lowdisplacement'],'compare'=>'>','valuetype'=>'float')); } if (isset($_REQUEST['highdisplacement'])&&strlen($_REQUEST['highdisplacement'])){//highdisplacement $smarty->assign('highdisplacement',floatval($_GET['highdisplacement'])); array_push($conditions,array('col'=>'displacement','value'=>$_REQUEST['highdisplacement'],'compare'=>'<','valuetype'=>'float')); } if (isset($_REQUEST['color'])&&intval($_REQUEST['color'])){//color $smarty->assign('color',intval($_GET['color'])); array_push($conditions,array('col'=>'color','value'=>$_REQUEST['color'],'compare'=>'=','valuetype'=>'int')); } if (isset($_REQUEST['company'])){//company $company=intval($_REQUEST['company']); if ($company){ array_push($conditions,array('col'=>'company','value'=>0,'compare'=>'>','valuetype'=>'int')); }else { array_push($conditions,array('col'=>'company','value'=>0,'compare'=>'=','valuetype'=>'int')); } }else { $company=-1; } $smarty->assign('company',$company); //根據查詢條件重組篩選條件 結束 //排序方式 if (isset($_REQUEST['orderby'])){ $order=isset($_REQUEST['order'])&&$_REQUEST['order']=='a'?'ASC':'DESC'; switch ($_REQUEST['orderby']){ default: case 'time': $orderby='time'; break; case 'price': $orderby='price'; break; case 'registeyear': $orderby='registeyear'; break; case 'mileage': $orderby='mileage'; break; case 'completerate': $orderby='completerate'; break; } $orders=array( array('col'=>$orderby,'order'=>$order) ); }else { $orders=array( array('col'=>'time','order'=>'DESC'), array('col'=>'id','order'=>'ASC') ); } $pageSize=20; $page=isset($_REQUEST['page'])?intval($_REQUEST['page']):1; $start=($page-1)*$pageSize; $cars=$usedCar->searchCars($conditions,$orders,$start,$pageSize); $i=0; if ($cars){ foreach ($cars as $car){ /*定義的常量數組*/ $cars[$i]->gearbox=$gearboxs[$car->gearbox]; /*geo*/ $thisGeo=$geo->getGeoByID($car->geoid); $cars[$i]->geoname=$thisGeo->name; if (!$car->slogo){ $cars[$i]->slogo='/images/'.AUTO_SKIN.'/ucar/tu-null_s.jpg'; } $i++; } } $smarty->assign('cars',$cars); /*獲取二手車列表--結束*/ /*分頁--開始*/ $total=$usedCar->searchCarsCount($conditions); $smarty->assign('total',$total); if (isset($_GET['company'])){ $smarty->assign('pagination',foregroundPage($total,$page,$pageSize,'?company='.intval($company).'&page=','')); }else { $smarty->assign('pagination',foregroundPage($total,$page,$pageSize,'?page=','')); } /*分頁--結束*/ /*活躍經銷商 start*/ $usedCarStore=new usedCarStore(); $activeStores=$usedCarStore->stores($geoid,1,1,0,$getStoreCount); $smarty->assign('activeStores',$activeStores); /*活躍經銷商 end*/ /*按照車體結構查詢商家二手車*/ $carsOfStoreByBodyStruct=array(); if ($bodyStructs){ $i=0; foreach ($bodyStructs as $bd){ $conditions=array( array('col'=>'checked','compare'=>'=','value'=>1,'valuetype'=>'int'), array('col'=>'inputfinish','compare'=>'=','value'=>1,'valuetype'=>'int'), array('col'=>'company','compare'=>'>','value'=>0,'valuetype'=>'int') ); if ($i>0){ array_push($conditions,array('col'=>'bodystruct','compare'=>'=','value'=>$i,'valuetype'=>'int')); } $orders=array( array('col'=>'time','order'=>'DESC'), array('col'=>'completerate','order'=>'DESC') ); $cars=$usedCar->searchCars($conditions,$orders,0,20); if ($cars){ $j=0; foreach ($cars as $c){ $cars[$j]->color=$colors[$c->color]; $thisStore=$usedCarStore->get($c->company); $cars[$j]->storeShortName=$thisStore->shortname; $j++; } } array_push($carsOfStoreByBodyStruct,$cars); $i++; } } $smarty->assign('carsOfStoreByBodyStruct',$carsOfStoreByBodyStruct); //經銷顧問 $consultants=$usedCarStore->consultants(0,0,2); if ($consultants){ $i=0; foreach ($consultants as $c){ $thisStore=$usedCarStore->get($c->storeid); $consultants[$i]->storeShortName=$thisStore->shortname; $consultants[$i]->storeTel=$thisStore->tel; $i++; } } $smarty->assign('consultants',$consultants); //個人車源 $conditions=array( array('col'=>'checked','compare'=>'=','value'=>1,'valuetype'=>'int'), array('col'=>'inputfinish','compare'=>'=','value'=>1,'valuetype'=>'int'), array('col'=>'company','compare'=>'=','value'=>0,'valuetype'=>'int') ); $ucarsOfPerson=$cars=$usedCar->searchCars($conditions,$orders,0,36); $smarty->assign('ucarsOfPerson',$ucarsOfPerson); //meta if (file_exists(ABS_PATH.'/meta/'.META_DIR.'/'.UCAR_DIR.'/index.php')){ $thisGeo=$defaultLocation; include_once(ABS_PATH.'/meta/'.META_DIR.'/'.UCAR_DIR.'/index.php'); } $smarty->display('usedauto/index.html'); } ?>波叔一波中特第8期2017 天津快乐10分软件 顶呱刮2017新票 456棋牌游戏中心官网 斯诺克 北京pk10开奖走势图 广西快乐双彩走势图dun 江西新时时彩 辽宁体育彩票 娱乐场所提示牌 广东快乐10分推荐