From f842142791b77649d60df34ffc3abbb24eb8a8be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=A7=D0=B0=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2?= <45812598+Chazovs@users.noreply.github.com> Date: Thu, 1 Apr 2021 15:09:16 +0300 Subject: [PATCH] Check products array for emptiness (#193) --- .../classes/general/icml/RetailCrmICML.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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),