]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Проверка на dev
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Nov 2024 14:18:11 +0000 (17:18 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Mon, 11 Nov 2024 14:18:11 +0000 (17:18 +0300)
erp24/media/controllers/FlowwowController.php
erp24/services/MarketplaceService.php

index 7c87188bd6c62dc28e70c00b08b82ba012a93efb..8027964715e7b70333244a1678676f3a559b0079 100644 (file)
@@ -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
index 9f9f9de125bf509b4a2ca63c452677a77bd08d4f..0f5ca4aa39b16975001531d0ace3b44498dad655 100644 (file)
@@ -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. Получение приоритетов