Example #1
0
 public function actionIndex()
 {
     $this->layout = 'home';
     $banner = new Banner();
     $listBanner = $banner->getAllBanner(7, 5);
     $dataBanner = array();
     foreach ($listBanner as $key => $value) {
         if (is_file(\Yii::$app->basePath . '\\web/assets/image/' . $value['image'])) {
             $dataBanner[] = array('title' => $value['title'], 'link' => $value['link'], 'image' => 'assets/image/' . $value['image']);
         }
     }
     $listTop = $banner->getAllBanner(9, 6);
     $dataTopBrand = array();
     foreach ($listTop as $key => $value) {
         if (is_file(\Yii::$app->basePath . '\\web/assets/image/' . $value['image'])) {
             $dataTopBrand[] = array('title' => $value['title'], 'link' => $value['link'], 'image' => 'assets/image/' . $value['image']);
         }
     }
     //get list product feature
     $module = new Module();
     $feature = new Featured();
     $setting = $module->getModule(28);
     $listFeature = $feature->getListProductFeature($setting);
     //get list product bestSeller
     $listBestSeller = $this->getBestSellerProducts();
     //get list image manufacture
     $listBannerManufacture = $banner->getAllBanner(8, 12);
     return $this->render('index', ['dataBanner' => $dataBanner, 'dataTopBrand' => $dataTopBrand, 'listFeature' => $listFeature, 'listBestSeller' => $listBestSeller, 'listBannerManufacture' => $listBannerManufacture]);
 }