From 1accf12777ac3c9250dc89bae081b77b86f40df3 Mon Sep 17 00:00:00 2001 From: Vladimir Fomichev Date: Thu, 18 Dec 2025 17:40:42 +0300 Subject: [PATCH] =?utf8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/controllers/MarketplaceOrdersController.php | 6 ++++-- erp24/views/marketplace-orders/index.php | 2 +- erp24/views/marketplace-orders/view.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erp24/controllers/MarketplaceOrdersController.php b/erp24/controllers/MarketplaceOrdersController.php index 3f7e60b7..e3d7a38c 100644 --- a/erp24/controllers/MarketplaceOrdersController.php +++ b/erp24/controllers/MarketplaceOrdersController.php @@ -66,8 +66,8 @@ class MarketplaceOrdersController extends Controller $searchModel = new MarketplaceOrdersSearch(); $dataProvider = $searchModel->search($this->request->queryParams); - // Добавляем eager loading для items для проверки готовности к отправке в 1С - $dataProvider->query->with('items'); + // Добавляем eager loading для items, store, mpstore для проверки готовности к отправке в 1С и отображения + $dataProvider->query->with(['items', 'store', 'mpstore']); $dataProvider->sort->defaultOrder = [ 'creation_date' => SORT_DESC, @@ -950,6 +950,8 @@ class MarketplaceOrdersController extends Controller ->with([ 'status1C', 'items', + 'store', + 'mpstore', ]) ->where(['id' => $id]) ->one(); diff --git a/erp24/views/marketplace-orders/index.php b/erp24/views/marketplace-orders/index.php index 9f466601..b00baff8 100644 --- a/erp24/views/marketplace-orders/index.php +++ b/erp24/views/marketplace-orders/index.php @@ -86,7 +86,7 @@ YiiAsset::register($this); 'attribute' => 'store_id', 'format' => 'raw', // добавляем raw формат 'value' => function ($model) { - $storeName = $model->store->name ?? '-'; + $storeName = $model->store ? $model->store->name : '-'; $warehouseId = $model->mpstore ? MarketplaceStore::getWarehouseId()[$model->mpstore->warehouse_id] ?? '-' : '-'; $warehouseGuid = $model->warehouse_guid ?? '-'; diff --git a/erp24/views/marketplace-orders/view.php b/erp24/views/marketplace-orders/view.php index f2458eac..061bd02b 100644 --- a/erp24/views/marketplace-orders/view.php +++ b/erp24/views/marketplace-orders/view.php @@ -12,7 +12,7 @@ use yii\web\View; $this->registerCssFile('@web/css/fancybox.css'); $this->registerJsFile('@web/js/fancybox.umd.js', ['position' => View::POS_END]); $this->registerJsFile('/js/bouquet/bouquet.js', ['position' => View::POS_END]); -$this->title = 'Заказ магазина ' . $model->store->name . ' от ' . $model->creation_date; +$this->title = 'Заказ магазина ' . ($model->store ? $model->store->name : 'Unknown') . ' от ' . $model->creation_date; $this->params['breadcrumbs'][] = ['label' => 'Marketplace Orders', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; \yii\web\YiiAsset::register($this); @@ -43,7 +43,7 @@ $this->params['breadcrumbs'][] = $this->title; [ 'attribute' => 'store_id', 'value' => function ($model) { - return $model->store->name; + return $model->store ? $model->store->name : '-'; } ], [ -- 2.39.5