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; ?>
- = Html::a(Yii::t('product', 'Create Brand'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> -
- = GridView::widget([ - 'dataProvider' => $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'), - ]); - }, + ++ = Html::a(Yii::t('product', 'Create Brand'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> +
+ = GridView::widget( + [ + 'dataProvider' => $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', - ], - ], - ]); ?> + ] + ); ?>- = Html::a(Yii::t('app', 'Create Brand Size'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> + = Html::a(Yii::t('app', 'Create Brand Size'), [ 'brand-size/create' ], [ 'class' => 'btn btn-success' ]) ?>
= GridView::widget( [ @@ -33,7 +33,10 @@ 'brand_id', 'image', - [ 'class' => 'yii\grid\ActionColumn' ], + [ + 'class' => 'yii\grid\ActionColumn', + 'controller' => 'brand-size', + ], ], ] ); ?> -- libgit2 0.21.4