GetList
CDBResult CPrice::GetList( string &by, string &order, array arFilter = Array() );
The method GetList returns a set of arrays each describing a single price. The set returned is sorted and optionally filtered.
Parameters
Parameter | Description |
---|---|
by | Name of the field by which the list of prices is to be sorted. Names
include the following:
|
order | Sort order. Can be one of the following:
|
arFilter | Array with fields by which the returned prices are to be filtered. Keys
are the field names; values are conditions. The array can have the
following keys:
|
Return Values
An instance of the class CDBResult containing a set of the associated arrays with the following keys.
Key | Description |
---|---|
ID | Price ID. |
PRODUCT_ID | Product ID. |
EXTRA_ID | The ID of a discount (or extra). |
CATALOG_GROUP_ID | Price type ID. |
PRICE | Price value. |
CURRENCY | Currency. |
CAN_ACCESS | If "Y", the current user is allowed to view prices of this type. If "N", prices of this type should be hidden. |
CAN_BUY | If "Y", the current user is allowed to purchase at prices of this type. Otherwise "N". |
CATALOG_GROUP_NAME | Name of the price type in the current language. |
Example
<? // Display a price of the type $PRICE_TYPE_ID for the product $PRODUCT_ID $db_res = CPrice::GetList(($b=""), ($o=""), Array("PRODUCT_ID"=>$PRODUCT_ID, "CATALOG_GROUP_ID"=>$PRICE_TYPE_ID)); if ($ar_res = $db_res->Fetch()) { echo CurrencyFormat($ar_res["PRICE"], $ar_res["CURRENCY"]); } else { echo "Price not found!"; } ?>
© «Bitrix24», 2001-2024