GetList
CDBResult CCatalogProduct::GetList( string &by, string &order, array arFilter = Array() );
The method GetList returns properties of products sorted and optionally filtered. The parameters returned pertain to a product itself; these are not catalog element properties.
Parameters
Parameter | Description |
---|---|
by | Field by which the returned collection entries are to be sorted. Can be
one of the following:
|
order | Sort order. Can be one of the following:
|
arFilter | Filter by which entries are to be sorted. The filter is an associated
array with the field names as keys and the conditions as values. The
following values are used:
Note |
Return Values
An instance of the class CDBResult containing a set of the associated arrays with the following keys.
Key | Description |
---|---|
ID | Product ID. |
QUANTITY | Quantity of product items in stock. |
QUANTITY_TRACE | "Y" tells the system to keep track of quantity of the product and decrement the counter upon successful order. |
WEIGHT | Product item weight. |
Example
<? // // Display ID's of the first 10 products that are // most in stock and automatically tracked // $ind = 0; $db_res = CCatalogProduct::GetList(($b="QUANTITY"), ($o="DESC"), array("QUANTITY_TRACE"=>"Y")); while (($ar_res = $db_res->Fetch()) && ($ind < 10)) { echo $ar_res["ID"].", "; $ind++; } ?>
© «Bitrix24», 2001-2024