V
V
Vasily Petrov2016-07-08 14:11:16
1C-Bitrix
Vasily Petrov, 2016-07-08 14:11:16

How to display a list of products by property in bitrix?

Tell me how to display a list of products by the value of one of the properties
here is an example

$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");

                $arFilter = Array(
                    "IBLOCK_ID" => 1,
                    "ACTIVE_DATE" => "Y",
                    "ACTIVE" => "Y",
                    "PROPERTY_ATT_AGE" => '23',
                );

                $res = CIBlockElement::GetList( [] , $arFilter , false , [ "nPageSize" => 6 ] , $arSelect );

In the trailer, the code is working, but it only displays basic information
array(4) {
  ["ID"]=>
  string(2) "22"
  ["IBLOCK_ID"]=>
  string(1) "1"
  ["NAME"]=>
  string(41) "Какой то продукт"
  ["DATE_ACTIVE_FROM"]=>
  NULL
}

Tell me how to display a photo and additional fields of the product?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Petrov, 2016-07-08
@token_bus

zayuzal this I do n’t know how correct it is (

A
Alexey Emelyanov, 2016-07-08
@babarun

In the $arSelect array, specify which fields and properties you need. To get the id of the images in your example, replace $arSelect with this

$arSelect = Array(
    "ID", 
    "IBLOCK_ID",
    "NAME", 
    "DATE_ACTIVE_FROM", 
    "DETAIL_PICTURE", 
    "PREVIEW_PICTURE", 
    "PROPERTY_*",
);

Here is a detailed description of the method dev.1c-bitrix.ru/api_help/iblock/classes/ciblockel...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question