A
A
Alexander2019-09-04 12:37:36
1C-Bitrix
Alexander, 2019-09-04 12:37:36

Filtering by element binding field?

There is a work element with a property binding to the element, which is associated with performers , the performer has a property of the list type: type of performer (IP or company).
You need to pull out all the work that was performed only by companies, not SP. Property values ​​are stored in separate tables for both the performer and the completed work.
I'm trying the following build:

$productFilter = array(
  'IBLOCK_ID' => 9,
  'ACTIVE' => 'Y',
  'ID' => CIBlockElement::SubQuery("PROPERTY_USER", array(
        "IBLOCK_ID" => 5,
        "ACTIVE" => "Y",
        "PROPERTY_TYPE" => array(2),
      )),
);
$pagination = array(
  'page' => isset($_REQUEST['page']) && (int) $_REQUEST['page'] > 0 ? (int) $_REQUEST['page'] : 1,
  'perPage' => 6
);
$items = CIBlockElement::GetList(
  array('SORT' => 'ASC'),
  $productFilter,
  false,
  array(
    'iNumPage' => $pagination['page'],
    'nPageSize' => $pagination['perPage']
  ),
  array( 
    'ID',
    'NAME',
    'PREVIEW_PICTURE',
    'PREVIEW_TEXT',
    'DETAIL_PAGE_URL',
    'DATE_CREATE',
        'PROPERTY_USER',
        'PROPERTY_USER.PROPERTY_TYPE'
  )
);

SubQuery returns empty value
Tried like this:
$productFilter = array(
  'IBLOCK_ID' => 9,
  'ACTIVE' => 'Y',
  'PROPERTY_USER.PROPERTY_TYPE'=> array(2),
      ),
);

It doesn’t work either, everything stretches absolutely

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