diff --git a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php index 9b4aae34..c41c46dc 100644 --- a/intaro.retailcrm/classes/general/icml/RetailCrmICML.php +++ b/intaro.retailcrm/classes/general/icml/RetailCrmICML.php @@ -373,19 +373,18 @@ class RetailCrmICML $arFilter ) { $dbResProducts = CIBlockElement::GetList($order, $arFilter, false, false, $arSelect); - - $products = array(); - + + $products = []; + while ($product = $dbResProducts->GetNext()) { // Compile products to array - $products[$product['ID']] = $product; - $products[$product['ID']]['offers'] = array(); - + $products[$product['ID']] = $product; + $products[$product['ID']]['offers'] = []; } unset($product); - if (!empty($iblockOffer['IBLOCK_ID'])) { + if (!empty($iblockOffer['IBLOCK_ID']) && !empty($products)) { $arFilterOffer = array( 'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'], 'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => array_keys($products),