Documentation

GetDiscountCatsList

Description and parameters

CDBResult
CCatalogDiscount::GetDiscountCatsList(
 array arOrder = array(),
 array arFilter = array(),
 array arGroupBy = false,
 array arNavStartParams = false,
 array arSelectFields = array()
);

Method returns a result of retrieved records with information on discounts associated to price types according to its parameters. Non-static method.

Call parameters

ParameterDescription
arOrder Array, according to which resulting records are sorted. Has the following appearance:
array(
"field_name1" => "sort_direction1",
"field_name2" => "sort_direction2",
. . .
)
"field_nameN" can have any record field and as "sort_directionX" can have values "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 and then sorts the result by second element and etc.). 

Default value - empty array() - 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:
  • ! - negation;
  • + - null, 0 and empty string also satisfy filter conditions.
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.
"fied_nameX" can have any record field.

Filter example:
array("!DISCOUNT_ID" => 15)
This filter indicates "selects all records with value in field DISCOUNT_ID (discount code) is not equal 15".

Default value - empty array() - indicates that filter result won't be filtered.
arGroupBy Array with fields for coupon grouping. Has the appearance:
array("field_name1", "field_names", . . .)
"field_nameN" can have any catalog field.

In case array is empty, method returns number of records satisfying the filter.
Default value - false - indicates that the result won't be grouped.
arNavStartParams Array with selection parameters. Can contain the following keys:
  • "nTopCount" - number of returned records will be limited from top by this key;
  • any key, received by method CDBResult::NavQuery as the third parameter.
Default value - false - no selection parameters.
arSelectFields Array with record fields to be returned by the method. You can specify only the fields that are required. In case array contains the value "*", returns all the available fields.

Default value - empty array() - returns all fields for the main query table.

Returned values

Returns CDBResult class object, containing set of associative array with keys:

  • ID - record code;
  • DISCOUNT_ID - discount code;
  • CATALOG_GROUP_ID - price type code.

In case arGroupBy is passed as empty, method returns number of records satisfying the filter.


© «Bitrix24», 2001-2024
Up