Get the elements on the description of the properties of the line



  • There's a multiple properties like a line: "CML2_TRAITS", need to get elements that have a field description (DESCRIPTION) contains the line "Зачеркнутая цена"♪ Here comes back the elements of which the value contains "2 900"I need a field. DECRIPTION

    $arSelect = Array();
    $arFilter = Array("IBLOCK_ID"=>8, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y", "PROPERTY_CML2_TRAITS" => "%2 900%");
    $res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
    while($ob = $res->GetNextElement())
    {
     $arFields = $ob->GetFields();
     print_r($arFields);
    }
    

    That's how it works, $oldPriceFilterID contains the necessary elements, but there's a quick-action problem, there's a first round of all the elements of the catalogue, and then they're already in nature. Is the solution easier?

    $arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");
    $arFilter = Array("IBLOCK_ID"=>8, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
    $oldPriceFilter = array();
    $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
    while($ob = $res->GetNextElement())
    {
     $arFields = $ob->GetFields();
     $arProps = $ob->GetProperties();
     //echo "<pre>";
    // print_r($arFields['ID']);
    // echo "</pre>"; 
     $oldPriceArray = $arProps['CML2_TRAITS']['DESCRIPTION'];
     if (in_array("Зачеркнутая цена", $oldPriceArray))  $oldPriceFilter[] = $arFields['ID'];
    }
    

    echo "<pre>";
    print_r($oldPriceFilter);
    echo "</pre>";



  • The answer is: DESCRIPTION Can't be filtered."




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2