Blame view

frontend/controllers/DiscountController.php 588 Bytes
b224f0ae   Alexey Boroda   Changes:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  <?php
  namespace frontend\controllers;
  
  use yii\web\Controller;
  use common\modules\product\models\Product;
  
  class DiscountController extends Controller
  {
      public function actionIndex()
      {
          $products = Product::find()
              ->where([
                  'akciya' => true,
              ])->with('variant', 'category')
              ->all();
          if (!empty($products))
          {
              return $this->render('discount', [
                  'products' => $products,
              ]);
          }
          else
          {
              return $this->render('empty');
          }
      }
  }