1
0
mirror of synced 2024-11-21 21:06:09 +03:00

Check products array for emptiness (#193)

This commit is contained in:
Сергей Чазов 2021-04-01 15:09:16 +03:00 committed by GitHub
parent 1d2a9dca82
commit f842142791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -373,19 +373,18 @@ class RetailCrmICML
$arFilter $arFilter
) { ) {
$dbResProducts = CIBlockElement::GetList($order, $arFilter, false, false, $arSelect); $dbResProducts = CIBlockElement::GetList($order, $arFilter, false, false, $arSelect);
$products = array(); $products = [];
while ($product = $dbResProducts->GetNext()) { while ($product = $dbResProducts->GetNext()) {
// Compile products to array // Compile products to array
$products[$product['ID']] = $product; $products[$product['ID']] = $product;
$products[$product['ID']]['offers'] = array(); $products[$product['ID']]['offers'] = [];
} }
unset($product); unset($product);
if (!empty($iblockOffer['IBLOCK_ID'])) { if (!empty($iblockOffer['IBLOCK_ID']) && !empty($products)) {
$arFilterOffer = array( $arFilterOffer = array(
'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'], 'IBLOCK_ID' => $iblockOffer['IBLOCK_ID'],
'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => array_keys($products), 'PROPERTY_' . $iblockOffer['SKU_PROPERTY_ID'] => array_keys($products),