]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-251] отображать в посланных и посылать только active=1 карточки c articule origin/feature_smirnov_erp-251_soft_deletion_from_matrix_erp
authorAlexander Smirnov <fredeom@mail.ru>
Fri, 29 Nov 2024 14:15:14 +0000 (17:15 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Fri, 29 Nov 2024 14:15:14 +0000 (17:15 +0300)
erp24/api2/controllers/YandexMarketController.php
erp24/controllers/YandexMarketController.php

index 84e2c14f0ad5fe8561f86b9f02b0b23b49b14c4c..ec1e56342a98c5f8c0db8fba3b705312b59c8028 100644 (file)
@@ -83,7 +83,7 @@ class YandexMarketController extends Controller
 
         $products = MarketplaceService::getMarketplaceProducts();
 
-        $matrixErp = MatrixErp::find()->where(['guid' => ArrayHelper::getColumn($products, 'id')])->all();
+        $matrixErp = MatrixErp::find()->where(['active' => 1, 'guid' => ArrayHelper::getColumn($products, 'id')])->all();
         $matrixErpByGuid = [];
         foreach ($matrixErp as $matrix) {
             /* @var $matrix MatrixErp */
index 11b931ed24098c394478ac3600fe07d0dd3f274a..8b0966e340aa84a7679c1fb7276ebda21a63f16e 100644 (file)
@@ -18,7 +18,7 @@ class YandexMarketController extends Controller
     public function actionViewCards() {
         $products = Products1c::find()->alias('p')->leftJoin('products_class pc', 'p.parent_id = pc.category_id')
             ->where(['pc.tip' => [ProductsClass::MARKETPLACE, ProductsClass::MARKETPLACE_ADDITIONAL]])->all();
-        $matrixErp = MatrixErp::find()->where(['guid' => ArrayHelper::getColumn($products, 'id')])->all();
+        $matrixErp = MatrixErp::find()->where(['active' => 1, 'guid' => ArrayHelper::getColumn($products, 'id')])->all();
         $matrixErpByGuid = [];
         foreach ($matrixErp as $matrix) {
             /* @var $matrix MatrixErp */
@@ -31,31 +31,9 @@ class YandexMarketController extends Controller
             if (($matrixErpByGuid[$product->id]->price->price ?? 0) == 0) {
                 continue;
             }
-            $model = [
-                'offer' => [
-                    'offerId' => $product->id,
-                    'category' => 'Цветы',
-                    'marketCategoryId' => '91284',
-                    'name' => !empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ?
-                        $matrixErpByGuid[$product->id]->matrixProperty->display_name : $product->name,
-                    'basicPrice' => [
-                        'currencyId' => Model\CurrencyType::RUR,
-                        'value' => $matrixErpByGuid[$product->id]->price->price,
-                    ],
-                    'vendor' => 'База Цветов 24',
-                    'weightDimensions' => new Model\OfferWeightDimensionsDTO([
-                        '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,
-                    ]),
-                    'pictures' => ['https://media.erp-flowers.ru/media/view-image/' . ($matrixErpByGuid[$product->id]->matrixProperty->image_id ?? null)],
-                    'description' => $matrixErpByGuid[$product->id]->matrixProperty->description ?? '-',
-                ],
-            ];
 
             $viewModels [] = [
-                'offerId' => $product->id,
+                'offerId' => $product->articule ?? $product->id,
                 'category' => 'Цветы',
                 'marketCategoryId' => 91284,
                 'name' => (!empty($matrixErpByGuid[$product->id]->matrixProperty->display_name) ?