From: Alexander Smirnov Date: Fri, 29 Nov 2024 14:15:14 +0000 (+0300) Subject: [ERP-251] отображать в посланных и посылать только active=1 карточки c articule X-Git-Tag: 1.7~218^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=305bdfd862b703326bedb9bbbd192acfcd44cc42;p=erp24_rep%2Fyii-erp24%2F.git [ERP-251] отображать в посланных и посылать только active=1 карточки c articule --- 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) ?