Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MasterHans/4906d481e488e754322cd140643cb29c to your computer and use it in GitHub Desktop.
Save MasterHans/4906d481e488e754322cd140643cb29c to your computer and use it in GitHub Desktop.
$letter = [];
$sQuery = '';
$sQuery .= 'SELECT DISTINCT ';
$sQuery .= 'UPPER(LEFT(LTRIM(NAME), 1)) AS LETTER ';
//$sQuery .= 'UPPER(NAME) AS LETTER ';
$sQuery .= 'FROM b_iblock_element BE ';
$sQuery .= 'WHERE BE.IBLOCK_ID = '.CONTENT_BREND_IB_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)) {
$letter[] = $arItem['LETTER'];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment