S
S
sportik1742022-03-24 11:00:08
1C-Bitrix
sportik174, 2022-03-24 11:00:08

How to get all products in JSON format 1C Bitrix?

Good afternoon!
There is an online store on 1C Bitrix
How can I get all the products by some url (for example , https://example.ru/api/products ) in JSON format

Maybe there are some ready-made solutions? (preferably free or inexpensive)

Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2022-03-24
@kikher

1. you create such section.
2. through api you choose what you need
3. the entire array of data in json_encode($data);

A
Anton, 2022-03-24
@anton99zel

Getting records

<?
$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");
$arFilter = Array("IBLOCK_ID"=>IntVal($yvalue), "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
while($ob = $res->GetNextElement()){ 
 $arFields = $ob->GetFields();  
print_r($arFields);
 $arProps = $ob->GetProperties();
print_r($arProps);
}
?>

We form the necessary into an array and make json out of it
json_encode($data)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question