$sQuery = '';
$sQuery .= 'SELECT DISTINCT ';
$sQuery .= 'UPPER(LEFT(LTRIM(NAME), '.$arParams['CHARS_COUNT'].')) AS LETTER ';
$sQuery .= 'FROM b_iblock_element BE ';
$sQuery .= 'WHERE BE.IBLOCK_ID = '.$arParams['IBLOCK_ID'].' AND BE.ACTIVE = "Y" AND BE.WF_STATUS_ID = 1 AND BE.WF_PARENT_ELEMENT_ID IS NULL';
$sQuery .= 'ORDER BY LETTER ASC ';
$rsItems = $GLOBALS['DB']->Query($sQuery, false, __LINE__);
while($arItem = $rsItems->GetNext(false, false)) {
$arResult['ITEMS'][$arItem['LETTER']] = $arItem;
}
|