diff --git a/backend/controllers/ProjectController.php b/backend/controllers/ProjectController.php index 20380b8..d209fbc 100755 --- a/backend/controllers/ProjectController.php +++ b/backend/controllers/ProjectController.php @@ -10,6 +10,7 @@ use common\modules\product\models\Product; use common\modules\product\models\ProductVariant; use Yii; + use yii\helpers\ArrayHelper; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; @@ -203,10 +204,11 @@ $products = Product::find() ->distinct() ->select([ - 'product.product_id', + 'product_lang.name', 'product.product_id', ]) ->joinWith('variants', true, 'INNER JOIN') + ->joinWith('lang', true, 'INNER JOIN') ->indexBy('product_id') ->asArray() ->column(); @@ -222,9 +224,11 @@ if(!empty( $model->product_id ) && !empty( $products[ $model->product_id ] )) { $variants = ProductVariant::find() ->select([ - 'product_variant_id', + 'product_variant_lang.name', + 'product_variant.product_variant_id', ]) - ->where([ 'product_id' => $model->product_id ]) + ->joinWith('lang', true, 'INNER JOIN') + ->where([ 'product_variant.product_id' => $model->product_id ]) ->asArray() ->indexBy('product_variant_id') ->column(); @@ -261,10 +265,11 @@ } $products = Product::find() ->select([ - 'product.product_id', + 'product_lang.name', 'product.product_id', ]) ->joinWith('variants', true, 'INNER JOIN') + ->joinWith('lang', true, 'INNER JOIN') ->indexBy('product_id') ->asArray() ->column(); @@ -272,9 +277,11 @@ if(!empty( $model->product_id ) && !empty( $products[ $model->product_id ] )) { $variants = ProductVariant::find() ->select([ - 'product_variant_id', + 'product_variant_lang.name', + 'product_variant.product_variant_id', ]) - ->where([ 'product_id' => $model->product_id ]) + ->joinWith('lang', true, 'INNER JOIN') + ->where([ 'product_variant.product_id' => $model->product_id ]) ->asArray() ->indexBy('product_variant_id') ->column(); @@ -308,13 +315,19 @@ $response = \Yii::$app->response; $response->format = $response::FORMAT_JSON; $product = Product::find() - ->with('variants') - ->where([ 'product_id' => $product_id ]) + ->joinWith('variants.lang', true, 'INNER JOIN') + ->where([ 'product.product_id' => $product_id ]) ->one(); if(empty( $product ) || empty( $product->variants )) { throw new NotFoundHttpException(); } - return $product->variants; + $variants = ArrayHelper::toArray($product->variants, [ + 'common\modules\product\models\ProductVariant' => [ + 'product_variant_id', + 'lang', + ], + ]); + return $variants; } /** diff --git a/backend/views/project/index.php b/backend/views/project/index.php index e1b8da0..e3d2c89 100755 --- a/backend/views/project/index.php +++ b/backend/views/project/index.php @@ -1,35 +1,40 @@ title = \Yii::t('app', 'Project'); -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\grid\GridView; + + /** + * @var yii\web\View $this + * @var common\models\ArticlesSearch $searchModel + * @var yii\data\ActiveDataProvider $dataProvider + */ + $this->title = \Yii::t('app', 'Project'); + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

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

$dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], + 'filterModel' => $searchModel, + 'columns' => [ 'project_id', 'date_add:date', [ - 'class' => 'yii\grid\ActionColumn', - 'buttons' => [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + 'image.imageUrl:image', + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ 'product' => function($url, $model) { - return Html::a(Html::tag('span', '', ['class' => 'glyphicon glyphicon-list']), $url); - } + return Html::a(Html::tag('span', '', [ 'class' => 'glyphicon glyphicon-list' ]), $url); + }, ], 'template' => '{product} {view} {update} {delete}', ], diff --git a/backend/views/project/product-create.php b/backend/views/project/product-create.php index 6cd5f76..3e52a61 100755 --- a/backend/views/project/product-create.php +++ b/backend/views/project/product-create.php @@ -14,9 +14,19 @@ * @var ProductToProject $model * @var array $variants */ - $this->title = \Yii::t('app', 'Create product to project'); + if($model->isNewRecord) { + $this->title = \Yii::t('app', 'Create product to project'); + } else { + $this->title = \Yii::t('app', 'Update product to project'); + } $this->params[ 'breadcrumbs' ][] = [ - 'label' => \Yii::t('app', 'Products to project'), + 'label' => \Yii::t('app', 'Project'), + 'url' => [ + 'index', + ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('app', 'Products to project' . ': ' . $project->lang->title), 'url' => [ 'product', 'id' => $project->project_id, @@ -24,26 +34,26 @@ ]; $this->params[ 'breadcrumbs' ][] = $this->title; ?> -
-

title) ?>

- field($model, 'product_id') - ->dropDownList($products, [ 'prompt' => \Yii::t('app', 'Выберите коллекцию')]); - ?> -
+
+

title) ?>

+ field($model, 'product_id') + ->dropDownList($products, [ 'prompt' => \Yii::t('app', 'Выберите коллекцию') ]); + ?> +
+ field($model, 'product_variant_id') + ->dropDownList($variants, [ 'prompt' => \Yii::t('app', 'Выберите товар') ]); + ?> +
field($model, 'product_variant_id') - ->dropDownList($variants, [ 'prompt' => \Yii::t('app', 'Выберите товар')]); + echo Html::submitInput(( $model->isNewRecord ? \Yii::t('app', 'Добавить') : \Yii::t('app', 'Обновить') ), [ 'class' => 'btn btn-success' ]); + $form::end(); ?>
- isNewRecord?\Yii::t('app', 'Добавить'):\Yii::t('app', 'Обновить')), [ 'class' => 'btn btn-success' ]); - $form::end(); - ?> -
registerJs(" + $this->registerJs(" $(document).on( 'change', '#producttoproject-product_id', function(e) { @@ -62,11 +72,11 @@ $this->registerJs(" $.each( data, function(key, value) { + $(dropDown) - .append(''); + .append(''); } ); - console.log('hiodde'); $(container).removeClass('hidden'); } } diff --git a/backend/views/project/product.php b/backend/views/project/product.php index 6a01ff9..4fc0f79 100755 --- a/backend/views/project/product.php +++ b/backend/views/project/product.php @@ -16,7 +16,11 @@ * @var Project $project */ - $this->title = \Yii::t('app', 'Product to project'); + $this->title = \Yii::t('app', 'Product to project: ') . $project->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('app', 'Project'), + 'url' => [ 'index' ], + ]; $this->params[ 'breadcrumbs' ][] = $this->title; ?>
@@ -33,9 +37,32 @@ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ - [ 'class' => 'yii\grid\SerialColumn' ], - 'product_variant_id', - 'project_id', + [ + 'attribute' => 'variant_name', + 'value' => function($model) { + /** + * @var ProductToProject $model + */ + return Html::a($model->productVariant->lang->name, [ + 'product/variant/view', + 'id' => $model->productVariant->product_variant_id, + ]); + }, + 'format' => 'html', + ], + [ + 'attribute' => 'product_name', + 'value' => function($model) { + /** + * @var ProductToProject $model + */ + return Html::a($model->product->lang->name, [ + 'product/manage/view', + 'id' => $model->product->product_id, + ]); + }, + 'format' => 'html', + ], [ 'class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}', diff --git a/backend/views/project/update.php b/backend/views/project/update.php index 221ccaf..5bca2fc 100755 --- a/backend/views/project/update.php +++ b/backend/views/project/update.php @@ -10,13 +10,13 @@ * @var Project $model * @var ProjectLang $model_langs */ - $this->title = \Yii::t('app', 'Update Project').': ' . $model->project_id; + $this->title = \Yii::t('app', 'Update Project').': ' . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => \Yii::t('app', 'Project'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->project_id, + 'label' => $model->lang->title, 'url' => [ 'view', 'id' => $model->project_id, diff --git a/backend/views/project/view.php b/backend/views/project/view.php index dbc4303..8068202 100755 --- a/backend/views/project/view.php +++ b/backend/views/project/view.php @@ -1,35 +1,49 @@ title = $model->project_id; -$this->params['breadcrumbs'][] = ['label' => \Yii::t('app', 'Project'), 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; + + use yii\helpers\Html; + use yii\widgets\DetailView; + + /** + * @var yii\web\View $this + * @var common\models\Project $model + */ + $this->title = $model->lang->title; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => \Yii::t('app', 'Project'), + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; ?>
- +

title) ?>

- +

- $model->project_id], ['class' => 'btn btn-primary']) ?> - $model->project_id], [ + $model->project_id, + ], [ 'class' => 'btn btn-primary' ]) ?> + $model->project_id, + ], [ 'class' => 'btn btn-danger', - 'data' => [ + 'data' => [ 'confirm' => \Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + 'method' => 'post', ], ]) ?>

- + $model, + 'model' => $model, 'attributes' => [ 'project_id', 'date_add:date', + 'lang.title', + 'lang.alias', + 'lang.description:html', + 'image.imageUrl:image', ], ]) ?> diff --git a/common/models/ArticlesSearch.php b/common/models/ArticlesSearch.php index a522cfb..81756af 100755 --- a/common/models/ArticlesSearch.php +++ b/common/models/ArticlesSearch.php @@ -55,7 +55,7 @@ public function search($params) { $query = Articles::find() - ->joinWith('lang'); + ->joinWith('lang', true, 'INNER JOIN'); // add conditions that should always apply here diff --git a/common/models/ProductToProject.php b/common/models/ProductToProject.php index 9850a4d..2628606 100755 --- a/common/models/ProductToProject.php +++ b/common/models/ProductToProject.php @@ -37,7 +37,7 @@ [ 'product_variant_id', 'project_id', - 'product_id' + 'product_id', ], 'required', ], @@ -104,6 +104,6 @@ return $this->hasOne(Product::className(), [ 'product_id' => 'product_id', ]) - ->viaTable('product_variant', [ 'product_variant_id' => 'product_variant_id' ]); + ->viaTable('product_variant as pv', [ 'product_variant_id' => 'product_variant_id' ]); } } diff --git a/common/models/ProductToProjectSearch.php b/common/models/ProductToProjectSearch.php index b108c3b..372ea93 100755 --- a/common/models/ProductToProjectSearch.php +++ b/common/models/ProductToProjectSearch.php @@ -1,68 +1,99 @@ $query, - ]); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); + + public $variant_name; + + public $product_name; + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'variant_name', + 'product_name', + ], + 'safe', + ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = ProductToProject::find() + ->joinWith('productVariant.lang') + ->joinWith('product.lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'variant_name' => [ + 'asc' => [ 'product_variant_lang.name' => SORT_ASC ], + 'desc' => [ 'product_variant_lang.name' => SORT_DESC ], + ], + 'product_name' => [ + 'asc' => [ 'product_lang.name' => SORT_ASC ], + 'desc' => [ 'product_lang.name' => SORT_DESC ], + ], + ], + ], + ]); + + $this->load($params); + + if(!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'like', + 'product_variant_lang.name', + $this->variant_name, + ]) + ->andFilterWhere([ + 'like', + 'product_lang.name', + $this->product_name, + ]); + return $dataProvider; } - - // grid filtering conditions - $query->andFilterWhere([ - 'product_to_project_id' => $this->product_to_project_id, - 'product_variant_id' => $this->product_variant_id, - 'project_id' => $this->project_id, - ]); - - return $dataProvider; } -} diff --git a/common/models/Project.php b/common/models/Project.php index a039078..97386cc 100755 --- a/common/models/Project.php +++ b/common/models/Project.php @@ -81,14 +81,6 @@ 'safe', ], [ - [ - 'title', - 'link', - ], - 'string', - 'max' => 255, - ], - [ [ 'date_add' ], 'filter', 'filter' => function($value) { @@ -105,8 +97,6 @@ { return [ 'project_id' => 'Project ID', - 'title' => 'Title', - 'link' => 'Link', 'description' => 'Description', 'date_add' => 'Date Add', 'images' => 'Images', diff --git a/common/models/ProjectSearch.php b/common/models/ProjectSearch.php index 94e4fdc..262c79b 100755 --- a/common/models/ProjectSearch.php +++ b/common/models/ProjectSearch.php @@ -1,71 +1,100 @@ $query, - ]); - - $this->load($params); - - if (!$this->validate()) { - // uncomment the following line if you do not want to return any records when validation fails - // $query->where('0=1'); + + public $title; + + public function behaviors() + { + return []; + } + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [ + [ + 'project_id', + 'date_add', + ], + 'integer', + ], + [ + [ 'title' ], + 'safe', + ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + // bypass scenarios() implementation in the parent class + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = Project::find() + ->joinWith('lang'); + + // add conditions that should always apply here + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'project_id', + 'date_add', + 'title' => [ + 'asc' => [ 'project_lang.title' => SORT_ASC ], + 'desc' => [ 'project_lang.title' => SORT_DESC ], + ], + ], + ], + ]); + + $this->load($params); + + if(!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'project_id' => $this->project_id, + 'date_add' => $this->date_add, + ]); + + $query->andFilterWhere([ + 'like', + 'project_lang.title', + $this->title, + ]); + return $dataProvider; } - - // grid filtering conditions - $query->andFilterWhere([ - 'project_id' => $this->project_id, - 'date_add' => $this->date_add, - ]); - - return $dataProvider; } -} diff --git a/common/modules/product/controllers/ManageController.php b/common/modules/product/controllers/ManageController.php index bb9a0ea..7ee50f6 100755 --- a/common/modules/product/controllers/ManageController.php +++ b/common/modules/product/controllers/ManageController.php @@ -365,14 +365,37 @@ } } + public function actionExportProcess($from, $filename) + { + + $model = new Export(); + if(Yii::$app->request->isAjax) { + Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; + return $model->process($filename,$from); + } + } + public function actionExport() { $model = new Export(); - if(( $file = $model->process(Yii::getAlias('@uploadDir')) )) { - return Yii::$app->response->sendFile($file) - ->send(); + + if($model->load(Yii::$app->request->post())) { + \Yii::$app->session->set('export_lang', $model->lang); + return $this->render('export-process', [ + 'model' => $model, + 'method' => 'export', + ]); } - throw new NotFoundHttpException('Error'); + + return $this->render('export', [ + 'model' => $model, + ]); + // $model = new Export(); + // if(( $file = $model->process(Yii::getAlias('@uploadDir')) )) { + // return Yii::$app->response->sendFile($file) + // ->send(); + // } + // throw new NotFoundHttpException('Error'); } /** diff --git a/common/modules/product/models/Export.php b/common/modules/product/models/Export.php index aec770f..04a3332 100755 --- a/common/modules/product/models/Export.php +++ b/common/modules/product/models/Export.php @@ -2,37 +2,64 @@ namespace common\modules\product\models; + use common\modules\language\models\Language; use yii\base\Model; class Export extends Model { + public $lang; + + public $file; + public $errors = []; public $output = []; - public function process($dirName, $filename = NULL, $use_not_enables = false) + public function rules() + { + return [ + [ + 'lang', + 'integer', + ], + [ + 'lang', + 'default', + 'value' => Language::getCurrent()->language_id, + ], + ]; + } + + public function process($filename = NULL, $from = 0) { - if(is_null($filename)) { + $limit = 100; + + if(empty( $filename )) { $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; + $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "w"); + } else { + $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "a"); } - setlocale(LC_ALL, 'ru_RU.CP1251'); - $handle = fopen($dirName . '/' . $filename, "w"); + + $language = Language::findOne(\Yii::$app->session->get('export_lang', Language::getDefaultLanguage()->language_id)); + Language::setCurrent($language->url); + $products = Product::find() - ->joinWith([ - 'variantsWithFilters', - 'brand', - 'categories', - ]) - ->with('filters') + ->with('variantsWithFilters', 'brand.lang', 'categories.lang', 'filters') + ->joinWith('lang', true, 'INNER JOIN') + ->limit($limit) + ->offset($from) ->all(); - + $filesize = Product::find() + ->joinWith('lang', true, 'INNER JOIN') + ->count(); foreach($products as $product) { $mods = []; $filterString = $this->convertFilterToString($product->filters); foreach($product->variantsWithFilters as $variant) { - $color = $variant->name; + $color = $variant->lang->name; $mods[] = $variant->sku . '=' . $this->convertFilterToString($variant->filters) . '=' . $color . '=' . ( ( !empty( $variant->image ) ) ? $variant->image->image : '' ) . '=' . $variant->stock; } @@ -40,17 +67,17 @@ $categories = []; foreach($product->categories as $value) { - $categories[] = $value->name; + $categories[] = $value->lang->name; } $categories = implode(',', $categories); $list = [ $categories, - $product->brand->name, - $product->name, + ( ( !empty( $product->brand ) ) ? $product->brand->lang->name : '' ), + $product->lang->name, '', - ( ( !empty( $product->description ) ) ? $product->description : '' ), + ( ( !empty( $product->lang->description ) ) ? $product->lang->description : '' ), $filterString, ( !empty( $product->variant ) ) ? $product->variant->price_old : '', ( !empty( $product->variant ) ) ? $product->variant->price : '', @@ -62,23 +89,40 @@ implode(',', $fotos), ]; $to_write = array_merge($list, $mods); - foreach($to_write as &$cell) { - $cell = iconv("UTF-8", "WINDOWS-1251", $cell); - } fputcsv($handle, $to_write, ';'); unset( $product ); } fclose($handle); - return $dirName . '/' . $filename; + $from += $limit; + $end = false; + if($from > $filesize) { + $end = true; + } + + $result = [ + 'end' => $end, + 'from' => $from, + 'totalsize' => $filesize, + 'filename' => $filename, + ]; + + if($end) { + $result = array_merge($result, [ + 'link' => '/storage/sync/' . $filename, + ]); + } + + return $result; + } public function convertFilterToString($filters) { $fittersArray = []; foreach($filters as $filter) { - $fittersArray[ $filter->taxGroup->alias ][] = $filter->value; + $fittersArray[ $filter->taxGroup->alias ][] = $filter->lang->value; } $filterString = []; diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php index 8b5904b..42e72d4 100755 --- a/common/modules/product/models/Product.php +++ b/common/modules/product/models/Product.php @@ -268,6 +268,7 @@ public function getVariantsWithFilters() { return $this->hasMany(ProductVariant::className(), [ 'product_id' => 'product_id' ]) + ->joinWith('lang', true, 'INNER JOIN') ->with([ 'filters', 'image', @@ -537,7 +538,8 @@ { return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ]) ->viaTable('product_option', [ 'product_id' => 'product_id' ]) - ->joinWith('taxGroup'); + ->joinWith('taxGroup.lang', true, 'INNER JOIN') + ->joinWith('lang', true, 'INNER JOIN'); } public function getProductSpec() diff --git a/common/modules/product/models/ProductVariant.php b/common/modules/product/models/ProductVariant.php index 00972ff..e48feca 100755 --- a/common/modules/product/models/ProductVariant.php +++ b/common/modules/product/models/ProductVariant.php @@ -199,7 +199,8 @@ return $this->hasMany(TaxOption::className(), [ 'tax_option_id' => 'option_id' ]) ->viaTable('product_variant_option', [ 'product_variant_id' => 'product_variant_id' ]) - ->joinWith('taxGroup'); + ->joinWith('taxGroup.lang', true, 'INNER JOIN') + ->joinWith('lang', true, 'INNER JOIN'); } /** diff --git a/common/modules/product/views/manage/export-process.php b/common/modules/product/views/manage/export-process.php new file mode 100644 index 0000000..ac250ed --- /dev/null +++ b/common/modules/product/views/manage/export-process.php @@ -0,0 +1,106 @@ + +registerJs("var in_process=true; + var count=1; + var filename = null; + + doExport(0,filename); + + function doExport(from,filename) { + from = typeof(from) != 'undefined' ? from : 0; + + $.ajax({ + method: 'get', + url: '".Yii::$app->request->baseUrl .'/product/manage/export-process'."', + data: { + from:from, + filename: filename + }, + dataType: 'json', + success: function(data){ + + var per = Math.round(100*data.from/data.totalsize)+'%'; + $('#progressbar div').css({width: per}); + + if(data != false && !data.end) + { + doExport(data.from,data.filename); + } + else + { + console.log(data.link); + $(progressbar).hide('fast'); + $('#result_link').attr('href', data.link).removeClass('hidden'); + in_process = false; + } + }, + error: function(xhr, status, errorThrown) { + } + }); + }"); +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Экспорт данных товаров

+ + [ + 'value' => 100, + 'label' => '' + ], + 'options' => [ + 'id' => 'progressbar' + ], + ]);?> +
    + +
    diff --git a/common/modules/product/views/manage/export.php b/common/modules/product/views/manage/export.php new file mode 100644 index 0000000..7338173 --- /dev/null +++ b/common/modules/product/views/manage/export.php @@ -0,0 +1,58 @@ + + +
    + false, + 'options' => [ 'enctype' => 'multipart/form-data' ], + ]); ?> + + errors) : ?> +
    + \n", $model->errors); ?> +
    + + + output) : ?> +

    Лог операции

    +
    + \n", $model->output); ?> +
    + + + field($model, 'lang') + ->dropDownList(Language::find() + ->select([ + 'name', + 'language_id', + ]) + ->where([ 'status' => 1 ]) + ->orderBy([ 'default' => SORT_DESC ]) + ->asArray() + ->indexBy('language_id') + ->column()) ?> + + field($model, 'file')->widget(\kartik\file\FileInput::classname(), [ + 'language' => 'ru', + 'options' => [ + 'multiple' => false, + ], + 'pluginOptions' => [ + 'allowedFileExtensions' => ['csv'], + 'overwriteInitial' => true, + 'showRemove' => false, + 'showUpload' => false, + ], + ])*/ ?> + +
    + 'btn btn-primary' ]) ?> +
    + + +
    \ No newline at end of file diff --git a/common/modules/rubrication/models/TaxGroup.php b/common/modules/rubrication/models/TaxGroup.php index da9ca02..32ce977 100755 --- a/common/modules/rubrication/models/TaxGroup.php +++ b/common/modules/rubrication/models/TaxGroup.php @@ -3,6 +3,7 @@ namespace common\modules\rubrication\models; use common\modules\language\behaviors\LanguageBehavior; + use common\modules\language\models\Language; use common\modules\product\models\Category; use yii\db\ActiveQuery; use yii\db\ActiveRecord; @@ -143,4 +144,13 @@ return $this->hasMany(TaxOption::className(), [ 'tax_group_id' => 'tax_group_id' ]) ->inverseOf('taxGroup'); } + + public function getAlias() { + $default_lang = Language::getDefaultLanguage(); + /** + * @var TaxGroupLang $lang + */ + $lang = $this->getLang($default_lang->language_id)->one(); + return $lang->alias; + } } -- libgit2 0.21.4