MOON
Server: Apache
System: Linux u18017238.onlinehome-server.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User: emblazeone (1003)
PHP: 7.3.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/emblazeone/public_html/master-template/frontend/controllers/ProductsController.php
<?php
namespace frontend\controllers;

use backend\modules\categories\models\Category;
use backend\modules\exercises\models\Exercises;
use backend\modules\pages\models\Pages;
use backend\modules\pages\models\PagesSites;
use backend\modules\products\models\Products;
use common\models\Identity;
use frontend\actions\GetProfileImageAction;
use wbp\images\models\Image;
use Yii;
use yii\data\ActiveDataProvider;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use yii\web\NotFoundHttpException;

/**
 * Site controller
 */
class ProductsController extends BaseController
{


    public function actionProduct($href){
        $product = $this->site->getProducts()->andWhere(['href'=>$href, 'status'=>Products::STATUS_ACTIVE])
            ->one();

        if(!$product){
            throw new NotFoundHttpException('Page Not Found.');
        }

        return $this->render($product->template, ['product'=>$product]);
    }
    public function actionIndex(){

        $dataProvider=new ActiveDataProvider([
            'query'=>$this->site->getProducts()->andWhere(['status'=>Products::STATUS_ACTIVE])
        ]);

        return $this->render('index', ['dataProvider'=>$dataProvider]);
    }

    public function actionCategory($href){
        $category = $this->site->getCategories()->andWhere(['href'=>$href, 'status'=>Category::STATUS_ACTIVE])
            ->one();

        if(!$category){
            throw new NotFoundHttpException('Page Not Found.');
        }

        $dataProvider=new ActiveDataProvider([
            'query'=>$category->getProducts()->andWhere(['status'=>Products::STATUS_ACTIVE])
        ]);

        return $this->render('category', ['category'=>$category, 'dataProvider'=>$dataProvider]);
    }

}