Documentation

getOffersList

Description and parameters

mixed 
CCatalogSKU::getOffersList(
 array productID,
 int iblockID = 0,
 array skuFilter = array(),
 array fields = array(),
 array propertyFilter = array()
)

Method returns SKUs for array with products from one or multiple iblocks. Static method.

Call parameters

Parameter Description
productID Array with product IDs.
iblockID Iblock ID. Optional, specified only if all products belong to a single iblock. Otherwise equals to null.
skuFilter Array for filtering SKUs: selects only the SKUs that satisfy filter. In case second parameter is not a null, you can filter by SKU properties as well. Otherwise, filtering is possible only by SKU fields, because filter is shared with all iblocks. Empty by default.
fields Array with list of returned SKU fields. In case you didn't specify them, returns only SKU ID and IBLOCK_ID.
propertyFilter Array with the list of returned SKU properties. Can contain one of keys:
  • ID - contains required properties ID (general list for all iblocks);
  • CODE - contains symbolic code for all required properties (general list for all iblocks).
If both keys are available, information is sourced from the key ID.
options Additional settings. Optional. Possible keys:
USE_PROPERTY_ID = Y - value array keys for each element uses property ID. Otherwise - character codes.
PROPERTY_FIELDS - array with PROPERTY fields, returned as the result.
GET_RAW_DATA => Y - in this case, returned data won't contain keys with ~ at the start, and the remaining won't be converted to be HTML-safe.

Returned value

On error (incorrect parameters) method returns false and on success returns array with product IDs with SKUs and values as SKU arrays (keys - SKU ID).

Examples

$res = CCatalogSKU::getOffersList(
        $productID, // array with product ID
        $iblockID = 0, // indicate iblock ID only for a COMPLETE array from a single iblock that is known
        $skuFilter = array(), // additional SKU filter. Empty by default.
        $fields = array(),  // array with SKU fields. Even if empty - returns ID and IBLOCK_ID
        $propertyFilter = array() /* SKU properties. Has 2 keys:
                               ID - array with SKU property ID
                                      or
                               CODE - array with character codes for SKU properties
                                     in case both keys are specified, ID*/ has priority
 );

© «Bitrix24», 2001-2024