Documentation

GetList

Description and parameters

CDBResult
CCatalogGroup::GetList(
 array arOrder = array(),
 array arFilter = array(),
 array arGroupBy = false,
 array arNavStartParams = false,
 array arSelectFields = array()
);

Method returns selection of records with catalog price types according to its own parameters. Static method.

ParametersDescription arOrder Array with sorting of resulting records. Array has the following appearance:
array(
"field_name1" => "sort_direction1",
"field_name2" => "sort_direction2",
. . .
)
"field_nameN" can contain any price catalog field and as "sort_directionX" can have "ASC" (by ascension) and "DESC" (by descension).

In case array with sorting has several elements, resulting set is sorted sequentially by each element (i. e. first sorts by first element, then result is sorted by second element and etc.). 

Default value - empty array() - indicates result won't be sorted. arFilter Array with parameters to build selection filter. Has the following appearance:
array(
"[modifier1][operator1]field_name1" => "value1",
"[modifier2][operator2]field_name2" => "value2",
. . .
)
Records that satisfy the filter are returned in the result and records that doesn't satisfy filter conditions are not included.

The following modifiers are deemed as permissible:
  • ! - отрицание;
  • + - значения null, 0 и пустая строка так же удовлетворяют условиям фильтра.
The operators are deemed as permissible:
  • >= - field value is higher or equal to the value passed to filter;
  • > - field value is strictly higher then value passed to filter;
  • <= - field value is less or equal to value passed to filter;
  • < - field value is strictly less than value passed to filter;
  • @ - operator can be used for in integer and real data when passing set of values (array). In this case, hen generating SQL query uses the SQL operatorIN, producing record form;
  • ~ - field value is checked for comparison to the template passed to filter;
  • % - field value is checked for comparison to the string passed to filter according to query language.
"field_nameX" can have any price catalog field.

Filter example:
array("SUBSCRIPTION" => "Y")
This filter indicates "retrieve all entries with value in the field SUBSCRIPTION (flag "Content selling") is Y".

Default value - empty array() - indicates non-filtered result. arGroupBy Array with fields to group entries with catalog price types. Array has the following appearance:
array("field_name1", "field_name2", . . .)
"field_nameN" can have any field with catalog price types.

In case of array is empty the method returns number of entries satisfying the filter.

Default value - false - indicates, that result won't be grouped. arNavStartParams Array with selection parameters. Can contain the following keys:
  • "nTopCount" - limits from the top the number of entries/records returned by the method;
  • any key, received by the method CDBResult::NavQuery as a third parameters.
Default value - false - indicates no parameters in a selection. arSelectFields Array with entry fields to be returned by the method. Can specify only the fields that are necessary. If array contains the value "*", returns all available fields.

Default value - empty array array() - indicates returning of all fields from the main query table.

Returned values

CDBResult class object, containing set of associative arrays with following keys:

Key Description Available from version
ID Price type code.
NAME Internal price type name.
BASE Flag (Y/N) set type as basis.
SORT Sort index.
CAN_ACCESS Flag (Y/N) set permission for current user to view prices of this type.
CAN_BUY Flag (Y/N) sets permission for current user to purchase products with prices of this type.
NAME_LANG Price type name on the specific language (lang).
XML_ID External code.
CREATED_BY User code who created price type.
MODIFIED_BY Recent user ID who updated price type.
TIMESTAMP_X Date of recent price type update.
DATE_CREATE Date when price type is created.

Example

<?
// Select price types with internal retail name
$dbPriceType = CCatalogGroup::GetList(
        array("SORT" => "ASC"),
        array("NAME" => "retail")
    );
while ($arPriceType = $dbPriceType->Fetch())
{
    echo $arPriceType["NAME_LANG"]." - ".$arPriceType["CAN_ACCESS"]."<br>";
}
?>


© «Bitrix24», 2001-2024
Up