public function actionIndex()
{
$searchModel = new ProductPitSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
$minPriceProduct = ProductPit::getMinPriceProduct(); выводит 50
$maxPriceProduct = ProductPit::getMaxPriceProduct(); выводит 9000
echo $form->field($model, 'price')->widget(Slider::classname(), [
'sliderColor' => Slider::TYPE_PRIMARY,
'handleColor' => Slider::TYPE_PRIMARY,
'pluginOptions' => [
'min' => minPriceProduct,
'max' => maxPriceProduct,
'step' => 1,
'range' => true
],
])->label('');
Uncaught Error: Invalid input value '9000' passed in
at Slider._validateArray (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:1411:13)
at Slider._validateInputValue (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:1401:11)
at Slider.setValue (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:749:30)
at Slider.createNewSlider (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:636:9)
at new Slider (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:298:20)
at HTMLInputElement.<anonymous> (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:151:20)
at http://sportpit.alex-sport.com.ua/assets/58241742/jquery.js:142:20
at Function.map (http://sportpit.alex-sport.com.ua/assets/58241742/jquery.js:452:13)
at jQuery.fn.init.map (http://sportpit.alex-sport.com.ua/assets/58241742/jquery.js:141:33)
at jQuery.fn.init.$.fn.(anonymous function) [as slider] (http://sportpit.alex-sport.com.ua/assets/94ee5539/js/bootstrap-slider.js:143:26)
[
'ProductPitSearch' => [
'price' => '845,2845'
]
]
echo '<b class="badge">0$</b> <b class="badge">1000$</b><br>';
echo $form->field($model, 'price')->widget(Slider::classname(), [
'sliderColor' => Slider::TYPE_PRIMARY,
'handleColor' => Slider::TYPE_PRIMARY,
'pluginOptions' => [
'min' => 0,
'max' => 1000,
'step' => 5,
'range' => true
],
])->label('');
public function search($params)
{
$query = ProductPit::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
public static function getProductByStatus($id)
{
return self::find()
->where(['category_id' => $id])
->andWhere(['status' => self::STATUS_PRODUCT_ON])
->asArray();
}
Nested sets строим дерево с drag&drop, мне оно очень помогло, понял трудные нюансы))
CategoryController тут я передаю $id категории потом рендерю в index
ProductPitSearch
В ListView index как тут передать $id ?
Я кажись что то не так делаю!?