Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use yii\helpers\Html;
- use yii\grid\GridView;
- use backend\models\Cat;
- use yii\web\NotFoundHttpException;
- use yii\web\Controller;
- use yii\helpers\FileHelper;
- use yii\helpers\Url;
- use yii\web\UploadedFile;
- use yii\helpers\VarDumper;
- use yii\helpers\ArrayHelper;
- use backend\models\ImagesManager;
- use backend\models\Product;
- /* @var $this yii\web\View */
- /* @var $searchModel backend\models\ProductSearch */
- /* @var $dataProvider yii\data\ActiveDataProvider */
- $this->title = 'Товары';
- $this->params['breadcrumbs'][] = $this->title;
- ?>
- <div class="product-index">
- <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
- <p>
- <?= Html::a('Добавить товар', ['create'], ['class' => 'btn btn-success']) ?>
- </p>
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'columns' => [
- ['class' => 'yii\grid\SerialColumn'],
- //'id',
- 'name',
- [
- 'attribute'=>'status',
- 'value' => function($data){
- return $data->status ? 'Активен' : 'Блокированный';
- }
- ],
- //'status',
- //'description',
- 'price_roz',
- 'price_opt',
- //'hit',
- //'new',
- // 'sale',
- //'category_id',
- [
- 'attribute'=>'category_id',
- 'value'=>function($data){
- return $data->category->name;
- },
- ],
- [
- 'attribute'=>'hit',
- 'format' => 'raw',
- 'value'=>function($data){
- return !$data->hit ? '<span class="text-success">Нет</span>' : '<span class="text-danger">Да</span>';
- },
- ],
- [
- 'attribute'=>'new',
- 'format' => 'raw',
- 'value'=>function($data){
- return !$data->new ? '<span class="text-success">Нет</span>' : '<span class="text-danger">Да</span>';
- },
- ],
- [
- 'attribute'=>'sale',
- 'format' => 'raw',
- 'value'=>function($data){
- return !$data->sale ? '<span class="text-success">Нет</span>' : '<span class="text-danger">Да</span>';
- },
- ],
- //'meta_title',
- //'meta_keyword',
- //'meta_description',
- ['class' => 'yii\grid\ActionColumn'],
- ],
- ]); ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement