DiscountController.php 588 Bytes
<?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');
        }
    }
}