public function getAllProductsByCategory($category_id) { $this->andWhere('status =:status', [':status' => 1]); $this->with('productCategories'); $this->limit(Custom::getCustomConfig()['max_top_rated']); $this->orderBy('id DESC'); return $this; }
/** * Displays homepage. * * @return mixed */ public function actionIndex() { $model_product = new Product(); $model_manufacturer = new Manufacturer(); $home_slider_product = $model_product->find()->getHomeSliderProduct()->all(); $top_ten_products = $model_product->find()->getLatestTenProducts()->all(); $top_ten_manufacturer = $model_manufacturer->find()->where('status =:status', [':status' => 1])->limit(Custom::getCustomConfig()['max_allowed_manufacturer'])->all(); return $this->render('index', ['home_slider_product' => $home_slider_product, 'top_ten_products' => $top_ten_products, 'top_ten_manufacturer' => $top_ten_manufacturer]); }