好的,现在 我有功能
public function getCarAttr()
{
$this->dao->select();
$this->dao->from( $this->getTable_CarAttr());
//$this->dao->where('fk_i_item_id', $itemId);
$this->dao->groupBy('i_year', 'ASC') ;
$result = $this->dao->get();
if( !$result ) {
return array() ;
}
return $result->result();
}
来自以下字段:
<div class="row one_input">
<h6><?php _e('Year', 'cars_attributes'); ?></h6>
<select name="year" id="year">
<option value=""><?php _e('From', 'cars_attributes'); ?></option>
<?php foreach($years as $y) { ?>
<option value="<?php echo $y['fk_i_item_id']; ?>" <?php if($year==$y['fk_i_item_id']) { echo 'selected'; } ?>><?php echo $y['i_year']; ?></option>
<?php } ?>
</select>
<select name="year" id="year">
<option value=""><?php _e('To', 'cars_attributes'); ?></option>
<?php foreach($years as $y) { ?>
<option value="<?php echo $y['fk_i_item_id']; ?>" <?php if($year==$y['fk_i_item_id']) { echo 'selected'; } ?>><?php echo $y['i_year']; ?></option>
<?php } ?>
</select>
</div>
然后:
// self-explanatory
function cars_item_detail() {
if( osc_is_this_category('cars_plugin', osc_item_category_id()) ) {
$detail = ModelCars::newInstance()->getCarAttr(osc_item_id()) ;
if( count($detail) == 0 ) {
return ;
}
$make = ModelCars::newInstance()->getCarMakeById( $detail['fk_i_make_id'] );
$model = ModelCars::newInstance()->getCarModelById( $detail['fk_i_model_id'] );
$car_type = ModelCars::newInstance()->getVehicleTypeById($detail['fk_vehicle_type_id']);
$year = ModelCars::newInstance()->getCarAttr($detail['i_year']);
$detail['s_make'] = '' ;
if( array_key_exists('s_name', $make) ) {
$detail['s_make'] = $make['s_name'];
}
$detail['s_model'] = '' ;
if( array_key_exists('s_name', $model) ) {
$detail['s_model'] = $model['s_name'];
}
$detail['locale'] = array() ;
foreach($car_type as $c) {
$detail['locale'][$c['fk_c_locale_code']]['s_car_type'] = $c['s_name'] ;
}
$detail['i_year'] = '' ;
if( array_key_exists('i_year', $model) ) {
$detail['i_year'] = $model['i_year'];
}
require_once 'item_detail.php' ;
}
}
// Adds some plugin-specific search conditions
function cars_search_conditions($params) {
// we need conditions and search tables (only if we're using our custom tables)
$has_conditions = false ;
foreach($params as $key => $value) {
// we may want to have param-specific searches
switch($key) {
case 'type':
if( is_numeric($value) ) {
Search::newInstance()->addConditions(sprintf("%st_item_car_attr.fk_vehicle_type_id = %d", DB_TABLE_PREFIX, $value));
$has_conditions = true;
}
break;
case 'make':
if( is_numeric($value) ) {
Search::newInstance()->addConditions(sprintf("%st_item_car_attr.fk_i_make_id = %d", DB_TABLE_PREFIX, $value));
$has_conditions = true;
}
break;
case 'model':
if( is_numeric($value) ) {
Search::newInstance()->addConditions(sprintf("%st_item_car_attr.fk_i_model_id = %d", DB_TABLE_PREFIX, $value));
$has_conditions = true;
}
break;
case 'year':
if( is_numeric($value) ) {
Search::newInstance()->addConditions(sprintf("%st_item_car_attr.i_year = %d", DB_TABLE_PREFIX, $value));
$has_conditions = true;
}
break;
case 'transmission':
if( $value == 'AUTO' || $value == 'MANUAL' ) {
Search::newInstance()->addConditions(sprintf("%st_item_car_attr.e_transmission = '%s'", DB_TABLE_PREFIX, $value));
$has_conditions = true;
}
break;
default:
break;
}
}
现在它向我展示了汽车生产年份没有问题, 他们从最低到最高排序没有问题
但我的问题是当我选择时说2001年和2003年 点击精简按钮后它出来2003年和2003年,系统显示“没有匹配的结果”任何想法??