$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,
->with([
'status1C',
'items',
+ 'store',
+ 'mpstore',
])
->where(['id' => $id])
->one();
'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 ?? '-';
$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);
[
'attribute' => 'store_id',
'value' => function ($model) {
- return $model->store->name;
+ return $model->store ? $model->store->name : '-';
}
],
[