From 876e255be8590e24f98ad601ffc2213de4569662 Mon Sep 17 00:00:00 2001 From: vasilevdm Date: Sat, 14 Aug 2021 12:18:03 +0300 Subject: [PATCH] Inventories upload fix --- .../general/inventories/RetailCrmInventories.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/intaro.retailcrm/classes/general/inventories/RetailCrmInventories.php b/intaro.retailcrm/classes/general/inventories/RetailCrmInventories.php index 02a04d0e..b70a246a 100644 --- a/intaro.retailcrm/classes/general/inventories/RetailCrmInventories.php +++ b/intaro.retailcrm/classes/general/inventories/RetailCrmInventories.php @@ -84,8 +84,8 @@ class RetailCrmInventories } $elems = array(); - $chunkStores = array_chunk($stores, 50, true); - foreach ($chunkStores as $stores) { + $storesChunks = array_chunk($stores, 50, true); + foreach ($storesChunks as $storesChunk) { foreach ($products as $product) { if (count($product['offers']) > 0) { $elems = array_merge($elems, $product['offers']); @@ -97,7 +97,7 @@ class RetailCrmInventories $invUpload = array(); $dbStoreProduct = CCatalogStoreProduct::GetList( array(), - array('PRODUCT_ID' => $elems, 'STORE_ID' => array_keys($stores)), + array('PRODUCT_ID' => $elems, 'STORE_ID' => array_keys($storesChunk)), false, false, array('PRODUCT_ID', 'STORE_ID', 'AMOUNT') @@ -109,8 +109,8 @@ class RetailCrmInventories ); } $invUpload[$arStoreProduct['PRODUCT_ID']]['stores'][] = array( - 'code' => $stores[$arStoreProduct['STORE_ID']], - 'available' => self::switchCount($arStoreProduct['AMOUNT'], $inventoriesType[$stores[$arStoreProduct['STORE_ID']]]), + 'code' => $storesChunk[$arStoreProduct['STORE_ID']], + 'available' => self::switchCount($arStoreProduct['AMOUNT'], $inventoriesType[$storesChunk[$arStoreProduct['STORE_ID']]]), ); } //for log