From cfbe69f4add47507568b59d0e7f1ddc05c617669 Mon Sep 17 00:00:00 2001 From: fomichev Date: Mon, 11 Nov 2024 17:18:11 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= =?utf8?q?=20=D0=BD=D0=B0=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/media/controllers/FlowwowController.php | 13 +++++++++---- erp24/services/MarketplaceService.php | 12 ++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/erp24/media/controllers/FlowwowController.php b/erp24/media/controllers/FlowwowController.php index 7c87188b..80279647 100644 --- a/erp24/media/controllers/FlowwowController.php +++ b/erp24/media/controllers/FlowwowController.php @@ -14,12 +14,8 @@ class FlowwowController extends Controller */ public function actionFeed($id) { - $productsInfo = MarketplaceService::getAllProductsInfo($id); - $products = MarketplaceService::infoForMarketplace(1, false); - - var_dump($products); die(); $xmlFeed = MarketplaceService::createXMLFeed($productsInfo); @@ -29,4 +25,13 @@ class FlowwowController extends Controller return $xmlFeed; } + + public function actionTest(){ + + $products = MarketplaceService::infoForMarketplace(1, false); + + var_dump($products); + + + } } \ No newline at end of file diff --git a/erp24/services/MarketplaceService.php b/erp24/services/MarketplaceService.php index 9f9f9de1..0f5ca4aa 100644 --- a/erp24/services/MarketplaceService.php +++ b/erp24/services/MarketplaceService.php @@ -64,8 +64,10 @@ class MarketplaceService ]; public static function infoForMarketplace(int $marketId, bool $is_yandex) { - if (!array_key_exists($marketId, MarketplaceStore::getWarehouseId())) - return; + if (!array_key_exists($marketId, MarketplaceStore::getWarehouseId())) { + return null; + } + $marketplacesCount = count(MarketplaceStore::getWarehouseId()); @@ -124,14 +126,16 @@ class MarketplaceService $bouquetCount = PHP_INT_MAX; foreach ($stockRecords as $productGuid => $values) { - $temp = intval($values['count'] / $products->$productGuid); + $temp = intval($values['count'] / $products[$productGuid]); $bouquetCount = !empty($bouquetCount) ? min($bouquetCount, $temp) : $temp; $store = $values['marketplace_guid']; - } + if (isset($bouquetCount) && $bouquetCount > 0) { $stocks[$guid] = ['count' => $bouquetCount, 'store' => $store]; } + } + } // 5. Получение приоритетов -- 2.39.5