1
0
mirror of synced 2025-01-19 09:21:41 +03:00

Inventories upload fix

This commit is contained in:
vasilevdm 2021-08-14 12:18:03 +03:00
parent 3676808046
commit 876e255be8

View File

@ -84,8 +84,8 @@ class RetailCrmInventories
} }
$elems = array(); $elems = array();
$chunkStores = array_chunk($stores, 50, true); $storesChunks = array_chunk($stores, 50, true);
foreach ($chunkStores as $stores) { foreach ($storesChunks as $storesChunk) {
foreach ($products as $product) { foreach ($products as $product) {
if (count($product['offers']) > 0) { if (count($product['offers']) > 0) {
$elems = array_merge($elems, $product['offers']); $elems = array_merge($elems, $product['offers']);
@ -97,7 +97,7 @@ class RetailCrmInventories
$invUpload = array(); $invUpload = array();
$dbStoreProduct = CCatalogStoreProduct::GetList( $dbStoreProduct = CCatalogStoreProduct::GetList(
array(), array(),
array('PRODUCT_ID' => $elems, 'STORE_ID' => array_keys($stores)), array('PRODUCT_ID' => $elems, 'STORE_ID' => array_keys($storesChunk)),
false, false,
false, false,
array('PRODUCT_ID', 'STORE_ID', 'AMOUNT') array('PRODUCT_ID', 'STORE_ID', 'AMOUNT')
@ -109,8 +109,8 @@ class RetailCrmInventories
); );
} }
$invUpload[$arStoreProduct['PRODUCT_ID']]['stores'][] = array( $invUpload[$arStoreProduct['PRODUCT_ID']]['stores'][] = array(
'code' => $stores[$arStoreProduct['STORE_ID']], 'code' => $storesChunk[$arStoreProduct['STORE_ID']],
'available' => self::switchCount($arStoreProduct['AMOUNT'], $inventoriesType[$stores[$arStoreProduct['STORE_ID']]]), 'available' => self::switchCount($arStoreProduct['AMOUNT'], $inventoriesType[$storesChunk[$arStoreProduct['STORE_ID']]]),
); );
} }
//for log //for log