public function actionIndex()
 {
     $coupons = new Coupon();
     $resultType = $coupons->couponType();
     $websites = new Website();
     $resultStores = $websites->websiteName();
     $coupons = new CouponCategories();
     $resultCategory = $coupons->storesName();
     $coupons = new Coupon();
     $resultDetail = $coupons->couponDetail();
     return $this->render('index', ['resultType' => $resultType, 'resultStores' => $resultStores, 'resultCategory' => $resultCategory, 'resultDetail' => $resultDetail]);
 }
 function getAllStoresName()
 {
     $result = CouponCategories::find()->orderBy('Name')->distinct(true)->select('Name')->all();
     $type = array();
     $ind = 0;
     foreach ($result as $value) {
         $type[$ind++] = $value->Name;
     }
     return $type;
 }
 public function actionIndex()
 {
     $model = new Coupon();
     $pageSize = 60;
     $couponData = $model->getAllCoupons($pageSize);
     $result = $couponData['coupons'];
     $pagination = $couponData['pagination'];
     $websites = Website::getAllWebsites();
     $categories = CouponCategories::getAllCouponCategories();
     //Coupon::$lastresult = $result;
     return $this->render('index', ['coupons' => $result, 'pagination' => $pagination, 'websites' => $websites, 'categories' => $categories]);
 }
Example #4
0
 function getAllCouponDetailByCategory($cat)
 {
     $category = new CouponCategories();
     $category->Name = $cat;
     $catId = $category->getCategoryId();
     $cpn = new CouponCategoryInfo();
     $cpn->CategoryID = $catId;
     $couponIds = $cpn->getCouponIds();
     $query = (new \yii\db\Query())->select('CouponType, Website.WebsiteName AS Site, Coupon.Description AS Description, Coupon.Expiry AS Expiry, CouponCode, WebsiteURL AS url')->from('Coupon, Website')->where(["CouponID" => $couponIds])->orderBy('CountSuccess DESC')->limit(60)->all();
     return $query;
 }
 public static function getAllCouponCategories()
 {
     $categories = CouponCategories::find()->limit(10)->all();
     return $categories;
 }
Example #6
0
 public function getCouponCategories()
 {
     return $this->hasMany(CouponCategories::className(), ['CategoryID' => 'CategoryID'])->viaTable('CouponCategoryInfo', ['CouponID' => 'CouponID']);
 }