D
D
D06erman2022-01-21 10:43:45
1C-Bitrix
D06erman, 2022-01-21 10:43:45

When paging an array, only one row is output per page. How to make 20-50 lines displayed on one page?

Good afternoon. The site mtk42.ru implemented a search by full name, number, make of the car!
If you enter on the page https://mtk42.ru/ru/transport/taksi/ in the search bar, let's say TOYOTA COROLLA. That leaves a table with pagination, but only one line appears on one page instead of 20. The parameter is "nPageSize" => 20). Maybe someone can suggest how to fix this.

The code itself:
<?
$s3= $_REQUEST["nn3"];
$s7= $_REQUEST["nn7"];
$s8= $_REQUEST["nn8"];
$s20= $_REQUEST["nn20"];
$s9= $_REQUEST["nn3_nn7_nn8_nn20"];
if($s9):
$arSelect = array("ID", "PROPERTY_s3");
$arrFilter = Array("IBLOCK_ID" => "225", "?PROPERTY_s3"=>$s9,"ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("ID" => "ASC"), $arrFilter, false, Array("nPageSize" => 20), $arSelect);
while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields->GetFields();
if($ar_fields["PROPERTY_S3_VALUE"]){
$s3=$s9;
}
endwhile;

$arSelect = array("ID", "PROPERTY_s8");
$arrFilter = Array("IBLOCK_ID" => "225", "?PROPERTY_s8"=>$s9,"ACTIVE"=>"Y");
while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields->GetFields();
if($ar_fields["PROPERTY_S8_VALUE"]){
$s8=$s9;
}
endwhile;
if(!$s8){
$arSelect = array("ID", "PROPERTY_s7");
$arrFilter = Array("IBLOCK_ID" => "225", "?PROPERTY_s7"=>$s9,"ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("ID" => "ASC"), $arrFilter, false, Array("nPageSize" => 20), $arSelect);
while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields-> GetFields();
if($ar_fields["PROPERTY_S7_VALUE"]){
$s7=$s9;
}
endwhile;
}

$arSelect = array("ID", "PROPERTY_s20");
$arrFilter = Array("IBLOCK_ID" => "225", "?PROPERTY_s20"=>$s9,"ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array("ID" => "ASC"), $arrFilter, false, Array("nPageSize" => 20), $arSelect);
while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields->GetFields();
if($ar_fields["PROPERTY_S20_VALUE"]){
$s20=$s9;
}
endwhile;
endif;
?> <?
$arSelect = array("ID", "NAME", "IBLOCK_ID");
$arrFilter = Array("IBLOCK_ID" => "225", "?PROPERTY_s3"=>$s3,"ACTIVE"=>"Y", "?PROPERTY_s7"=>$s7,"?PROPERTY_s8"=>$s8, "?PROPERTY_s20"=>$s20);
$res = CIBlockElement::GetList(Array("ID" => "ASC"), $arrFilter, false, Array("nPageSize" => 20, "bShowAll" => false), $arSelect);
while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields->GetFields();
$arProperty = $arfields->GetProperties();
?><?endwhile?>


Ordinal registration number

Date of registration, including a legal entity, individual entrepreneur

Full (abbreviated) company name and organizational and legal form of a legal entity, full name of an individual entrepreneur

State registration number of the entry on the creation of a legal entity, on the state registration of an individual entrepreneur

Number and date of issue of the permit, period of validity of the permit

Make, model and state registration plate of the vehicle

Number and date of issue of the duplicate permit

Number and date of renewal of the permit

Grounds and date of termination of the permit

Date, details of the order to eliminate the identified violations

Grounds and date of the decision to suspend the permit, its details

Grounds and date of the decision to renew the permit, its details

Grounds and date of the decision to extend the permit, its details

Основание и дата решения суда об отзыве (аннулировании) разрешения, его реквизиты

Примечание

Муниципальное образование

<?=$ar_fields["NAME"]?>

<?=$arProperty["s2"]["VALUE"]?>

<?=$arProperty["s3"]["VALUE"]?>

<?=$arProperty["s5"]["VALUE"]?>

<?=$arProperty["s7"]["VALUE"]?>

<?=$arProperty["s8"]["VALUE"]?>

<?=$arProperty["s9"]["VALUE"]?>

<?=$arProperty["s10"]["VALUE"]?>

<?=$arProperty["s11"]["VALUE"]?>

<?=$arProperty["s13"]["VALUE"]?>

<?=$arProperty["s14"]["VALUE"]?>

<?=$arProperty["s15"]["VALUE"]?>

<?=$arProperty["s16"]["VALUE"]?>

<?=$arProperty["s18"]["VALUE"]?>

<?=$arProperty["s19"]["VALUE"]?>

<?=$arProperty["s20"]["VALUE"]?>

<?global $navComponentObject;?>
<?$res->NavPrint("Lines")?>

ON the output page shows 20 lines, but only one.
61ee0975b484d049539881.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Tkachev, 2022-01-26
@Real_Farmer

while ($arfields = $res->GetNextElement()):
$ar_fields = $arfields->GetFields();
It looks like you're not saving data to an array.
and the last value from the selection is written to the $ar_fields variable. Here, only 1 element is displayed.
replace with
$ar_fields[] = $arfields->GetFields();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question