Example #1
0
 public function actionViewCategory()
 {
     $page = Yii::$app->getRequest()->getQueryParam('page');
     $cateQueryArr = Product::getCategoryArr();
     //        dd($cateQueryArr);
     $products = Product::getProductsInCate(['listCategories' => $cateQueryArr, 'limit' => 4, 'page' => $page]);
     //dd($products);
     $count = Product::countProduct();
     $categories = Category::showCategory();
     //         dd(count($products));
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $count]);
     //        dd(count($products));
     return $this->render('view-category', ['categories' => $categories, 'products' => $products, 'pagination' => $pagination]);
 }