From: Alexander Smirnov Date: Wed, 13 Nov 2024 17:36:57 +0000 (+0300) Subject: [ERP-148] вывод отправляемых на маркет данных 3 X-Git-Tag: 1.6~3^2~3 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=b5d8d56f38d8aab7f692bd8d4cf1c216e387b5f1;p=erp24_rep%2Fyii-erp24%2F.git [ERP-148] вывод отправляемых на маркет данных 3 --- diff --git a/erp24/api2/controllers/YandexMarketController.php b/erp24/api2/controllers/YandexMarketController.php index 75ddb86b..b7973d83 100644 --- a/erp24/api2/controllers/YandexMarketController.php +++ b/erp24/api2/controllers/YandexMarketController.php @@ -4,6 +4,7 @@ namespace app\controllers; use Matrix\Matrix; use Yii; +use yii\grid\GridView; use yii\helpers\ArrayHelper; use yii\rest\Controller; use OpenAPI\Client\Configuration; @@ -92,6 +93,12 @@ class YandexMarketController extends Controller $matrixErpByGuid[$matrix->guid] = $matrix; } $models = []; +// $viewModels = []; + if (!$do) { + $output .= "" . + "" . + ""; + } foreach ($products as $product) { /* @var $product Products1c */ if (($matrixErpByGuid[$product->id]->price->price ?? 0) == 0) { @@ -110,22 +117,44 @@ class YandexMarketController extends Controller ], 'vendor' => 'База Цветов 24', 'weightDimensions' => new Model\OfferWeightDimensionsDTO([ - 'height' => $matrixErpByGuid[$product->id]->matrixProperty->height ?? 40, 'length' => $matrixErpByGuid[$product->id]->matrixProperty->length ?? 23, - 'weight' => $matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15, + 'height' => $matrixErpByGuid[$product->id]->matrixProperty->height ?? 40, 'width' => $matrixErpByGuid[$product->id]->matrixProperty->width ?? 20, + 'weight' => $matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15, ]), - 'description' => $matrixErpByGuid[$product->id]->matrixProperty->description ?? '-', 'pictures' => ['https://media.erp-flowers.ru/media/view-image/' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)], + 'description' => $matrixErpByGuid[$product->id]->matrixProperty->description ?? '-', ], ]; if ($do) { $models [] = new Model\UpdateOfferMappingDTO($model); } else { - ob_start(); - echo "
"; var_dump($model); echo "
"; - $output .= ob_get_clean(); + $output .= ""; +// $viewModels [] = [ +// 'offerId' => $product->id, +// 'category' => 'Цветы', +// 'marketCategoryId' => 91284, +// 'name' => (!empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ? +// $matrixErpByGuid[$product->id]->matrixProperty->display_name : $product->name), +// 'price' => $matrixErpByGuid[$product->id]->price->price, +// 'vendor' => 'База Цветов 24', +// 'length' => ($matrixErpByGuid[$product->id]->matrixProperty->length ?? 23), +// 'height' => ($matrixErpByGuid[$product->id]->matrixProperty->height ?? 40), +// 'width' => ($matrixErpByGuid[$product->id]->matrixProperty->width ?? 20), +// 'weight' => ($matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15), +// 'picture' => ('https://media.erp-flowers.ru/media/view-image/' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)), +// 'description' => ($matrixErpByGuid[$product->id]->matrixProperty->description ?? '-'), +// ]; } } @@ -137,9 +166,29 @@ class YandexMarketController extends Controller ob_start(); var_dump($apiInstance->updateoffermappings(5330887, $apiModel)); $output .= ob_get_clean(); - }; - - return "Обновить страницу" . str_repeat(" ", 5) . - "Отослать данные $output"; + } else { + $output .= '
offerIdКатегорияmarketCategoryIdНазваниеБазовая Цена, рБрендДлина, смВысота, смШирина, смВес, кгКартинкаОписание
" . $product->id . "Цветы91284" . + (!empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ? + $matrixErpByGuid[$product->id]->matrixProperty->display_name : $product->name) . "" + . $matrixErpByGuid[$product->id]->price->price . "База Цветов 24" . + ($matrixErpByGuid[$product->id]->matrixProperty->length ?? 23) . "" . + ($matrixErpByGuid[$product->id]->matrixProperty->height ?? 40) . "" . + ($matrixErpByGuid[$product->id]->matrixProperty->width ?? 20) . "" . + ($matrixErpByGuid[$product->id]->matrixProperty->weight ?? 0.15) . "" . + ('https://media.erp-flowers.ru/media/view-image/' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)) . "" . + ($matrixErpByGuid[$product->id]->matrixProperty->description ?? '-') . "
'; +// $output .= GridView::widget([ +// 'dataProvider' => $viewModels, +// 'columns' => [ +// ['class' => 'yii\grid\SerialColumn'], +// 'offerId', +// 'category', +// 'marketCategoryId', +// 'name', +// 'price', +// 'vendor', +// 'length', +// 'height', +// 'width', +// 'weight', +// 'picture', +// 'description', +// ], +// ]); + } + + return "Обновить страницу" . str_repeat(" ", 15) . + "Отослать данные
$output"; } } \ No newline at end of file