array arOrder = Array("SORT"=>"ASC"),
array arFilter = Array(),
bool bIncCnt = false
Returns list of iblocks by filter arFilter sorted in the order arOrder. Static method.
Returned object CDBResult.
|Parameter||Description ||Available from version|
|arOrder || Array for result sorting. Contains pairs "sort field"=>"sort category". Field for sorting can have the following values:
- id - iblock code;
- iblock_type - iblock code;
- name - iblock name;
- active - active status;
- code - symbolic code;
- sort - sort index;
- element_cnt - number of elements (только если bIncCnt = true);
- timestamp_x - date of the last update.
|arFilter || Array type array("filtered field"=>"filter value" [, ...]). Filtered field can have the values:
Type of filtration can be indicated in front of the filtered field name:
- ACTIVE - filter by active status (Y|N);
- NAME - by name (can be searched by template [%_]);
- EXTERNAL_ID, XML_ID - by external code (can be searched by template [%_]);
- SITE_ID - by site;
- TYPE - by iblock type (can be searched by template [%_]);
- CODE - by symbolic code (can be searched by template [%_]);
- ID - by code;
- VERSION - by property value storage flag for iblock elements;
- SOCNET_GROUP_ID - by social network group ID, used for iblock;
- CNT_ACTIVE - only if bIncCnt = true. When value is Y, element calculation will include only active elements and all elements with any other value;
- CNT_ALL - only if bIncCnt = true. When value is Y, element calculation will also include element that weren't published yet and all elements in case of any other value;
- MIN_PERMISSION - filter by access permissions, receives R by default (Read access permissions level).
- CHECK_PERMISSIONS - if "N", access permissions are not checked.
If access permission is not needed, you can indicate the value "N" to expedite the process. Additionally, if this parameter is not indicated in the filter, and you do not update "no access" default parameter, then the result issued to standard user will be empty.
- PERMISSIONS_BY - filtering by arbitrary user access permissions. Value - user ID or 0 (non-authorized).
All filtered fields except (CHECK_PERMISSIONS, MIN_PERMISSION, CNT_ALL and CNT_ACTIVE) can contain type if filter check in front of name.
- "!" - not equal
- "<" - less than
- "<=" - less or equal
- ">" - more than
- ">=" - more or equal
"filter value" - single value or array.
Optional. Default records are not filtered.
|bIncCnt || Enables returning number elements in the iblock inside the field ELEMENT_CNT. Optional parameter, equals false by default. || |
Note: when copying the code to your porject, it's recommended to remove optional parameter bIncCnt (if its not used) to avoid issues with performance.
// select all active iblocks for current site with catalog type
// that have symbolic code not as my_products, with active element counter.
$res = CIBlock::GetList(
while($ar_res = $res->Fetch())
echo $ar_res['NAME'].': '.$ar_res['ELEMENT_CNT'];
© «Bitrix24», 2001-2023