From 305bdfd862b703326bedb9bbbd192acfcd44cc42 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Fri, 29 Nov 2024 17:15:14 +0300 Subject: [PATCH] =?utf8?q?[ERP-251]=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?utf8?q?=D0=B6=D0=B0=D1=82=D1=8C=20=D0=B2=20=D0=BF=D0=BE=D1=81=D0=BB?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B8=20=D0=BF=D0=BE=D1=81?= =?utf8?q?=D1=8B=D0=BB=D0=B0=D1=82=D1=8C=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA?= =?utf8?q?=D0=BE=20active=3D1=20=D0=BA=D0=B0=D1=80=D1=82=D0=BE=D1=87=D0=BA?= =?utf8?q?=D0=B8=20c=20articule?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/YandexMarketController.php | 2 +- erp24/controllers/YandexMarketController.php | 26 ++----------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/erp24/api2/controllers/YandexMarketController.php b/erp24/api2/controllers/YandexMarketController.php index 84e2c14f..ec1e5634 100644 --- a/erp24/api2/controllers/YandexMarketController.php +++ b/erp24/api2/controllers/YandexMarketController.php @@ -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 */ diff --git a/erp24/controllers/YandexMarketController.php b/erp24/controllers/YandexMarketController.php index 11b931ed..8b0966e3 100644 --- a/erp24/controllers/YandexMarketController.php +++ b/erp24/controllers/YandexMarketController.php @@ -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) ? -- 2.39.5