J
J
Jupiter Max2020-11-20 10:00:35
1C-Bitrix
Jupiter Max, 2020-11-20 10:00:35

Why are fewer items displayed than in the array in catalog.section?

Hello. I was confused about the output of TP to the directory.

In result_modifier I get TP

$offersItemId = array();

foreach ($arResult['ITEMS'] as $item){

  $IBLOCK_ID = $arParams["IBLOCK_ID"]; 
  $ID = $item['ID']; 
  $arInfo = CCatalogSKU::GetInfoByProductIBlock($IBLOCK_ID); 
  if (is_array($arInfo)) 
  { 
     $rsOffers = CIBlockElement::GetList(array(),array('IBLOCK_ID' => $arInfo['IBLOCK_ID'], 'PROPERTY_'.$arInfo['SKU_PROPERTY_ID'] => $ID)); 
     while ($arOffer = $rsOffers->GetNext()) 
    {
      $offersItemIblock = $arOffer["IBLOCK_ID"];
      $offersItemId[] = $arOffer["ID"];
    }
  }
}

$arOfferItem = array();

$arFilter = Array("IBLOCK_ID"=>$offersItemIblock, "ID"=>$offersItemId);
$arSelect = Array("*");
$res = CIBlockElement::GetList(Array("SORT"=>"ASC"), $arFilter, false, array(), $arSelect);

while($ob = $res->GetNextElement()){
  $arFields = $ob->GetFields();
  $arFields["PROPERTIES"] = $ob->GetProperties();
  $arOfferItem[] = $arFields;
}
//echo '<pre>'; print_r($arOfferItem); echo '</pre>';
//$arResult["ITEMS"] = $arOfferItem;


if in tempalte.php I display an array of TP
echo '<pre>'; print_r($arOfferItem); echo '</pre>';

then I get all the TPs with properties, etc.

if I write to $arResult["ITEMS"] = $arOfferItem; TP then at the output I get only 3 goods, and there are 10 of them.

Where do I do it wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question