GetList
Description and parameters
CDBResult
CCatalogDiscountCoupon::GetList (
array $arOrder = array(),
array $arFilter = array(),
mixed $arGroupBy = false,
mixed $arNavStartParams = false,
array $arSelectFields = array()
);
Method selects coupons corresponding to conditions. Non-static method.
Call parameters
Parameter | Description |
---|---|
arOrder | Array consisting of array(by1=>order1[, by2=>order2 [, ..]]), where by - field for sorting, can have the following values:
|
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:
Optional. By default, coupons are not 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:
|
arSelectedFields | Array with record fields to be returned by the method. You can indicate the following fields: ID, DISCOUNT_ID, ACTIVE, ONE_TIME, COUPON, DATE_APPLY, DISCOUNT_NAME and DESCRIPTION. In case array contains the value "*", returns all available fields. Optional. By default prints all fields. |
Returned value
Method returns CDBResult class object.
See Also
Examples
Example for getting coupon by "Coupon code":
if (CModule::IncludeModule("catalog")) { $arFilter = array('COUPON' => 'CP-R8RFW-5YGGPZJ'); $dbCoupon = CCatalogDiscountCoupon::GetList (array(), $arFilter); if($arCoupon = $dbCoupon->Fetch()) { echo "<pre>"; print_r($arCoupon); echo "</pre>"; } else { echo "coupon unavailable"; } }
© «Bitrix24», 2001-2024