P
P
Pavel2019-02-18 10:15:27
1C-Bitrix
Pavel, 2019-02-18 10:15:27

Bitrix - how to search by product property?

I'm doing a custom search in the catalog. Using the CIBlockElement class, you can get properties by product ID, but I want to do a search by name. How can this be done?
Well, at the same time, the question is, where in this function is the infoblock from which it will pull data is set?

$ID = 56767;

if(CModule::IncludeModule("iblock")):
    $prop=CIBlockElement::GetByID($ID)->GetNextElement()->GetProperties();
endif;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
2cha.headz, 2019-02-18
@sidiqi

if by name, then something like this

$name = 'название';
$arSelect = Array("*");
$arFilter = Array("IBLOCK_ID"=>IntVal($yvalue), "NAME"=>$name);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
while($ob = $res->GetNextElement()){ 
    $arFields = $ob->GetFields();  
    print_r($arFields);
    $arProps = $ob->GetProperties();
    print_r($arProps);
}

here CIBlockElement::GetByID no infoblock is specified anywhere, only the element ID is specified

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question