public static function getVechileByVID($vid) { $model = GoodsBrand::model()->findByPk($vid); return $model->name . $model->car; }
?> <?php echo Chtml::dropDownList('city', $search['city'], $city_update, array('class' => 'width118 select', 'empty' => '请选择城市', 'ajax' => array('type' => 'GET', 'url' => Yii::app()->request->baseUrl . '/common/dynamiccity', 'update' => '#Dealer_area', 'data' => 'js:"city="+jQuery(this).val()'))); ?> <label style="margin-left:30px;">适用车系:</label> <?php $make_data = GoodsBrand::getBrand(); $make = CHtml::listData($make_data, "id", "name"); ?> <?php echo CHtml::dropDownList('make', $search['make'], $make, array('class' => 'width118 select', 'empty' => '请选择品牌', 'ajax' => array('type' => 'GET', 'url' => Yii::app()->request->baseUrl . '/common/getcarbyid', 'update' => '#car', 'data' => 'js:"make="+jQuery(this).val()'))); ?> <?php if ($_GET['make']) { $brand = GoodsBrand::model()->find('id=' . $_GET['make']); $data = GoodsBrand::model()->findAll("name=:Make", array(":Make" => $brand['name'])); $data = CHtml::listData($data, "id", "car"); // $vehicleModel_data=GoodsBrand::model()->find("id=:id",array(":id"=>$search['vehicleMake'])); } ?> <?php $vehicleModel_update = $_GET['make'] ? $data : array(); ?> <?php echo CHtml::dropDownList('car', $_GET['car'], $vehicleModel_update, array('class' => 'width118 select', 'empty' => '请选择车系')); ?> <input type="hidden" value="1" name='is'> <input type="submit" value="查 询" class="submit" style="margin-left:30px;"> <?php //if(!empty($search['is'])): ?>
public function actionGetyearbyid() { echo CHtml::tag("option", array("value" => ''), '请选择年款', true); if ($_GET["car"]) { $brand = GoodsBrand::model()->find('id=' . $_GET['car']); $data = GoodsBrand::model()->findAll("car=:car", array(":car" => $brand['car'])); $data = CHtml::listData($data, "id", "year"); foreach ($data as $value => $name) { echo CHtml::tag("option", array("value" => $value), CHtml::encode($name), true); } } }