【问题标题】:Yii2 how to add price range filter in search modelYii2如何在搜索模型中添加价格范围过滤器
【发布时间】:2019-12-24 08:49:53
【问题描述】:

我在 yii2 中创建了一个搜索模型。我想在其中添加价格起始和价格结束文本字段以及过滤条件。现在下面给出的过滤选项

$query->andFilterWhere([
            'id' => $this->id,
            'city_id' => $this->city_id,
            'price' => $this->price, <====Here i want to add price range
            'age_id' => $this->age_id,
            'usage_id' => $this->usage_id,
            'condition_id' => $this->condition_id,
            'seller_type_id' => $this->seller_type_id,
            'warranty_id' => $this->warranty_id,
            'flag' => $this->flag,
        ]);

我该怎么做

【问题讨论】:

    标签: php search filter yii


    【解决方案1】:

    我就是这么干的

    $query->andFilterWhere(['between','price',$this->price_start,$this->price_end])
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-11
      • 1970-01-01
      • 2016-11-23
      • 2017-02-12
      • 2019-08-03
      相关资源
      最近更新 更多