function saveOffer($arOffer, &$arStrToSave) { $curGoodId = $arOffer['goods_id']; if (!isset($arStrToSave[$curGoodId])) { $arrGood = Goods::getName($curGoodId, 'array'); $arRow['id'] = $curGoodId; $arRow['goods_type'] = $arOffer['goods_type_type']; $arRow['name'] = Goods::getName($curGoodId); $arRow['heigth'] = $arrGood['values']['tyre_heigth']; $arRow['width'] = $arrGood['values']['tyre_width']; $arRow['dia'] = $arrGood['values']['tyre_dia']; $arRow['i_load'] = $arrGood['values']['tyre_i_load']; $arRow['i_speed'] = $arrGood['values']['tyre_i_speed']; $arRow['model'] = $arrGood['values']['tyre_model']; $arRow['rf'] = $arrGood['values']['tyre_rf'] ? 44 : ''; $arRow['brand'] = $arrGood['values']['tyre_brand']; $arRow['season'] = $arrGood['values']['tyre_season']; $arRow['type_auto'] = $arrGood['values']['tyre_type_auto']; $arRow['spike'] = $arrGood['values']['tyre_spike'] ? 3 : ''; $arStrToSave[$curGoodId]['g'] = $arRow; } unset($arOffer['name'], $arOffer['goods_type_type']); $arStrToSave[$curGoodId]['o'][$arOffer['providers_id']] = $arOffer; }
<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel app\models\AccordsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Имя в прайсе'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="accords-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'identifier', ['attribute' => 'providers_id', 'label' => 'Поставщик', 'format' => 'html', 'filter' => yii\helpers\ArrayHelper::map(app\models\Providers::find()->all(), 'id', 'name'), 'value' => function ($model) { return app\models\Providers::findOne($model->providers_id)->name; }], ['attribute' => 'link_category', 'label' => 'Товар', 'format' => 'html', 'value' => function ($model) { return \app\components\Goods::getName($model->goods_id); }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{delete}']]]); ?> </div>