/**
  * Lists all Product models.
  * @return mixed
  */
 public function actionIndex()
 {
     //if(!Yii::$app->user->can('viewYourAuth')) throw new ForbiddenHttpException(Yii::t('app', 'No Auth'));
     $searchModel = new ProductSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * Lists all Product models.
  * @return mixed
  */
 public function actionIndex()
 {
     $pageSize = 10;
     $searchModel = new ProductSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $pageSize);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * Lists all Product models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ProductSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     //$criteria = new CDbCriteria;
     //		$criteria->compare('receive_header_id', $receiveHeader->id);
     //		$detailsDataProvider = new CActiveDataProvider('ReceiveDetail', array(
     //			'criteria'=>$criteria,
     //		));
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Exemple #4
0
 public function actionSearch()
 {
     $session = Yii::$app->session;
     $this->is_home_page = false;
     $search_param = Yii::$app->request->get('search');
     $cId_param = Yii::$app->request->get('cId');
     $cName_param = Yii::$app->request->get('cName');
     $search_params = ['cId' => strip_tags($cId_param), 'cName' => strip_tags($cName_param), 'search' => strip_tags($search_param)];
     if (!empty($search_param) || $cId_param) {
         $searchModel = new ProductSearch();
         $products = $searchModel->search($search_params);
     } else {
         $products = Product::find()->select('id, image, name, original_url, price')->indexBy('id')->orderBy('created_ts DESC')->limit(40)->all();
     }
     return $this->render('index', ['products' => $products, 'search' => true, 'search_text' => $search_param]);
 }
Exemple #5
0
 /**
  * Get product's list by category
  * @return ActiveDataProvider
  */
 public function getProductsList()
 {
     $ids = $this->id;
     //subcategory
     if ($nested = $this->nestedCategories) {
         $ids = ArrayHelper::getColumn($nested, 'id');
     }
     $productSearch = new ProductSearch(['scenario' => ProductSearch::SCENARIO_CATALOG]);
     return $productSearch->catalogSearch(Yii::$app->request->getQueryParams(), $ids);
 }
 /**
  * Lists all Product models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new ProductSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
     return $this->render('index', ['dataProvider' => $dataProvider, 'searchModel' => $searchModel]);
 }
 public function actionIndex()
 {
     $search = new ProductSearch();
     $provider = $search->search(\Yii::$app->request->get());
     return $this->render('index', ['search' => $search, 'dataProvider' => $provider]);
 }