Удаление дублей
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
function find () { $arSelect = Array("ID", "PROPERTY_111"); $arFilter = Array("IBLOCK_ID"=> 9, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y"); $res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect); $arr = array(); $i = 0; while($r = $res->GetNext()){ $arr[$r['ID']] = $r['PROPERTY_111_VALUE']; $i++; } return $arr; } $find = find(); $arr = array(); foreach ($find as $key => $value) { $arr[$value][] = $key; } $el = new CIBlockElement; foreach ($arr as $key2 => $value2) { if ($value2[1]){ echo $value2[1]; $el->Delete($value2[1]); } } |