Documentation

GetCatalogPrices

Description and parameters

array CIBlockPriceTools::GetCatalogPrices(
  int IBLOCK_ID, 
  array arPriceCode
);

Method returns list of price types with type parameters and option enabling viewing and purchase of this price type for current user groups. Static method.

Call parameters

Parameter Description
IBLOCK_ID Information block identifier. In actuality, the parameter is used only in Bitrix24 editions without the Commercial catalog module, despite being a required parameter.
arPriceCode Array, depending on product edition:
  • when Bitrix24 edition includes Commercial catalog module, its an array of codes (NAME field) for price types for data collecting.
  • when Bitrix24 edition does not have Commercial catalog module its an array of Number property type IDs for information block IBLOCK_ID.

Returned value

Returns an array. Its empty in case of an error. When information is available, returns an array with the following structure:

  • For Bitrix24 edition with Commercial catalog module:

    Key - price type ID. Value - away with fields as follows:

    • ID - price type identifier;
    • TITLE - language-dependent price type name on the current language, converted to html-safe format. When the name for current language is not specified, the field is empty (empty string);
    • SELECT - price selection ID to add to $arSelect of method CIBlockElement::GetList (when required, prices must be selected jointly with information block elements);
    • CAN_VIEW - (true/false) flag that specifies this price type viewing access permission to a group or groups that current user is a member of;
    • CAN_BUY - (true/false) flag that specifies this price type purchasing access permission to a group or groups that current user is a member of.

    Example for viewing the results

    CModule::IncludeModule('catalog');
    $res = CIBlockPriceTools::GetCatalogPrices(1, array('BASE', 'RETAIL', 'DISCOUNT'));
    echo '<pre>', mydump($res), '</pre>';
    
  • For Bitrix24 Editions without Commercial catalog module:

    Key - property ID. Value - array with the same fields, but:

    • ID - information block property ID;
    • TITLE - html safe property name;
    • SELECT - property value selection code for adding to $arSelect of method CIBlockElement::GetList;
    • CAN_VIEW - always true;
    • CAN_BUY - always false.


© «Bitrix24», 2001-2024