Documentation

GetItemPrices

Description and parameters

array CIBlockPriceTools::GetItemPrices(
  int IBLOCK_ID, 
  array arCatalogPrices, 
  array arItem, 
  bool bVATInclude = true, 
  array arCurrencyParams = array(),
  int USER_ID = 0, 
  string LID = SITE_ID
)

Method returns prices for element with accounted discounts (when its a commercial catalog). Static method.

Call parameters

Parameter DescriptionAvailable from version
IBLOCK_ID Element iblock ID. Presently is not used in ID.
arCatalogPrices Array with data, depending on product edition:
arItem Iblock element, retrieved by the method CIBlockElement::GetList:
  • Bitrix24 edition with Commercial catalog module, element must contain price data.
  • Bitrix24 edition without Commercial catalog module - property type Number, mentioned in CIBlockPriceTools::GetCatalogPrices.
bVATInclude (true/false) Flag includes/excludes VAT into price.
arCurrencyParams Array of parameters, responsible for price conversion into a single currency.
USER_ID User ID (groups are sourced for current user when unavailable or equal to zero. When available, calculates for this specific user). Parameter affects discount selection. Optional.
LID Site ID (when not specified, sets current site). Parameter affects selection of discounts. Optional.

Returned value

Returns an array. Array is empty in case of an error or missing available price types (no purchase, no viewing or missing prices). When successful, returns array with the following structure:

  1. Bitrix24 edition with Commercial catalog module:

    Key - price type ID. Value - array with fields:

    • ID - price quote ID;
    • PRICE_ID - price type ID;
    • CAN_ACCESS - (true/false) defines access for viewing this price type;
    • CAN_BUY - (true/false) defines access for purchasing via this price type;
    • MIN_PRICE - (Y/N) Y enables access for viewing a minimum price;
    • VALUE_NOVAT - prices ex-VAT;
    • PRINT_VALUE_NOVAT - formatted prices ex-VAT;
    • VALUE_VAT - price with VAT;
    • PRINT_VALUE_VAT - formatted price with VAT;
    • VATRATE_VALUE - absolute VAT value (not interest);
    • PRINT_VATRATE_VALUE - formatted absolute VAT value;
    • DISCOUNT_VALUE_NOVAT - price with discount ex-VAT;
    • PRINT_DISCOUNT_VALUE_NOVAT - formatted price with discount ex-VAT;
    • DISCOUNT_VALUE_VAT - discount's VAT;
    • PRINT_DISCOUNT_VALUE_VAT - formatted discount VAT;
    • DISCOUNT_VATRATE_VALUE - price with discount with VAT;
    • PRINT_DISCOUNT_VATRATE_VALUE - formatted price with discount with VAT;
    • CURRENCY - currency code;
    • the following parameters depend on parameter $bVATInclude. When true, values with VAT are copied to these parameters, otherwise - values without VAT are copied:
      • VALUE - price to be displayed;
      • PRINT_VALUE - formatted price to be displayed;
      • DISCOUNT_VALUE - price with discount;
      • PRINT_DISCOUNT_VALUE - formatted price with discount;
      • DISCOUNT_DIFF - discount value;
      • DISCOUNT_DIFF_PERCENT - interest rate with rounding up whole
      • PRINT_DISCOUNT_DIFF - formatted discount value;
    • keys with prefix ORIG_ are assigned in case when conversion to single currency is enabled and the original currency differs from target converted currency. Such keys contain original data.

  2. Bitrix24 edition without Commercial catalog module - currency conversion and VAT are not used:

    Key - property ID. Value - array with fields:

    • CURRENCY - sourced from property DESCRIPTION;
    • CAN_ACCESS - always true;
    • CAN_BUY - always false;
    • PRICE_ID - property ID;
    • ID - property ID;
    • VALUE - property value;
    • PRINT_VALUE - property and description values (currency type);
    • DISCOUNT_VALUE - always VALUE;
    • PRINT_DISCOUNT_VALUE - always PRINT_VALUE;
    • MIN_PRICE - Y for minimum of property values;
    • DISCOUNT_DIFF_PERCENT - always 0;
    • DISCOUNT_DIFF - always 0;
    • PRINT_DISCOUNT_DIFF - always 0 and value description (currency type).

Before sending (via getlist) the retrieved array to the parameter arItem, add a filter to your getlist:

$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]); foreach($arResult["PRICES"] as &$value) { if (!$value['CAN_VIEW'] && !$value['CAN_BUY']) continue; $arSelect[] = $value["SELECT"]; $arFilter["CATALOG_SHOP_QUANTITY_".$value["ID"]] = $arParams["SHOW_PRICE_COUNT"]; } if (isset($value)) unset($value);


© «Bitrix24», 2001-2024
Up