public static function newvehicleinfo($GoodsID) { $vehicle = PapGoodsVehicleRelation::model()->findAll('GoodsID=:GoodsID', array(':GoodsID' => $GoodsID)); foreach ($vehicle as $key => $value) { $arr[$key]['Make'] = $value->attributes['Make']; $arr[$key]['Car'] = $value->attributes['Car']; $arr[$key]['Year'] = $value->attributes['Year']; $arr[$key]['Model'] = $value->attributes['Model']; $arr[$key]['Marktxt'] = $value->attributes['Marktxt']; $arr[$key]['Cartxt'] = $value->attributes['Cartxt']; $arr[$key]['Modeltxt'] = $value->attributes['Modeltxt']; } return $arr; }
/** * 获取车型车系 */ public static function getVehicleByGoodsID($goodsID) { $goodsVehicle = PapGoodsVehicleRelation::model()->findAll("GoodsID={$goodsID}"); $data = array(); $Vehicles = ''; foreach ($goodsVehicle as $key => $value) { $data[$key]['ID'] = $value['ID']; $data[$key]['Make'] = $value['Make']; $data[$key]['Car'] = $value['Car']; $data[$key]['Year'] = $value['Year']; $data[$key]['Model'] = $value['Model']; $year = $value['Year'] == 0 ? '' : $value['Year']; $modeltxt = $value['Modeltxt'] ? $value['Modeltxt'] : ''; if ($key == 0) { $Vehicles .= $value['Marktxt'] . ' ' . $value['Cartxt'] . ' ' . $year . ' ' . $modeltxt; } else { $Vehicles .= '、' . $value['Marktxt'] . ' ' . $value['Cartxt'] . ' ' . $year . ' ' . $modeltxt; } } return $Vehicles; }