From 8e356b8c3cdc49f8ea34396910a42cae1fec09bb Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Dec 2016 13:40:07 +0200 Subject: [PATCH] -Sizes half way done --- controllers/BrandController.php | 51 ++++++++++++++++++++++++++------------------------- models/Product.php | 5 +++++ views/brand/index.php | 73 +++++++++++++++++++++++++++++++++++++++++++------------------------------ views/brand/size.php | 7 +++++-- 4 files changed, 79 insertions(+), 57 deletions(-) diff --git a/controllers/BrandController.php b/controllers/BrandController.php index f411692..4f5985b 100755 --- a/controllers/BrandController.php +++ b/controllers/BrandController.php @@ -24,31 +24,32 @@ public function behaviors() { return [ - 'access' => [ - 'class' => AccessControl::className(), - 'rules' => [ - [ - 'actions' => [ - 'login', - 'error', - ], - 'allow' => true, - ], - [ - 'actions' => [ - 'logout', - 'index', - 'create', - 'update', - 'view', - 'delete', - 'delete-image', - ], - 'allow' => true, - 'roles' => [ '@' ], - ], - ], - ], +// 'access' => [ +// 'class' => AccessControl::className(), +// 'rules' => [ +// [ +// 'actions' => [ +// 'login', +// 'error', +// ], +// 'allow' => true, +// ], +// [ +// 'actions' => [ +// 'logout', +// 'index', +// 'create', +// 'update', +// 'view', +// 'delete', +// 'delete-image', +// 'size', +// ], +// 'allow' => true, +// 'roles' => [ '@' ], +// ], +// ], +// ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [ diff --git a/models/Product.php b/models/Product.php index 82fea3d..da3077a 100755 --- a/models/Product.php +++ b/models/Product.php @@ -662,6 +662,11 @@ ->distinct(); } + public function getSize() + { + $size = BrandSize::find()->joinWith('categories')->createCommand()->rawSql; + } + /** * Setter for Categories * diff --git a/views/brand/index.php b/views/brand/index.php index cee1f78..4abc642 100755 --- a/views/brand/index.php +++ b/views/brand/index.php @@ -17,35 +17,48 @@ $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- -

title) ?>

- -

- 'btn btn-success' ]) ?> -

- $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - 'id', - [ - 'attribute' => 'brandName', - 'value' => 'lang.title', - ], - 'imageUrl:image', - [ - 'attribute' => 'in_menu', - 'content' => function($model) { - /** - * @var Brand $model - */ - return Html::tag('span', '', [ - 'class' => 'glyphicon glyphicon-'.($model->in_menu?'ok':'remove'), - ]); - }, + +

title) ?>

+ +

+ 'btn btn-success' ]) ?> +

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + [ + 'attribute' => 'brandName', + 'value' => 'lang.title', + ], + 'imageUrl:image', + [ + 'attribute' => 'in_menu', + 'content' => function($model) { + /** + * @var Brand $model + */ + return Html::tag( + 'span', + '', + [ + 'class' => 'glyphicon glyphicon-' . ( $model->in_menu ? 'ok' : 'remove' ), + ] + ); + }, + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ + 'size' => function($url, $model) { + return Html::a('', ['size', 'id' => $model->id]); + }, + ], + 'template' => '{size} {view} {update} {delete}', + ], ], - [ 'class' => 'yii\grid\ActionColumn', - ], - ], - ]); ?> + ] + ); ?>
diff --git a/views/brand/size.php b/views/brand/size.php index b73b770..0e35036 100755 --- a/views/brand/size.php +++ b/views/brand/size.php @@ -21,7 +21,7 @@ render('_search', ['model' => $searchModel]); ?>

- 'btn btn-success' ]) ?> + 'btn btn-success' ]) ?>

'yii\grid\ActionColumn' ], + [ + 'class' => 'yii\grid\ActionColumn', + 'controller' => 'brand-size', + ], ], ] ); ?> -- libgit2 0.21.4