- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
- Класс: BitrixIblockComponentBase
- Вызов: Base::modifyElementPrices
protected function modifyElementPrices(&$element)
{
$enableCompatible = $this->isEnableCompatible();
$id = $element['ID'];
$iblockId = $element['IBLOCK_ID'];
$catalog = !empty($this->storage['CATALOGS'][$element['IBLOCK_ID']])
? $this->storage['CATALOGS'][$element['IBLOCK_ID']]
: array();
$element['ITEM_PRICE_MODE'] = null;
$element['ITEM_PRICES'] = array();
$element['ITEM_QUANTITY_RANGES'] = array();
$element['ITEM_MEASURE_RATIOS'] = array();
$element['ITEM_MEASURE'] = array();
$element['ITEM_MEASURE_RATIO_SELECTED'] = null;
$element['ITEM_QUANTITY_RANGE_SELECTED'] = null;
$element['ITEM_PRICE_SELECTED'] = null;
if (!empty($catalog))
{
if (!isset($this->productWithOffers[$iblockId]))
$this->productWithOffers[$iblockId] = array();
if ($element['PRODUCT']['TYPE'] == CatalogProductTable::TYPE_SKU)
{
$this->productWithOffers[$iblockId][$id] = $id;
if ($this->storage['SHOW_CATALOG_WITH_OFFERS'] && $enableCompatible)
{
$this->productWithPrices[$id] = $id;
$this->calculatePrices[$id] = $id;
}
}
if (in_array(
$element['PRODUCT']['TYPE'],
array(
CatalogProductTable::TYPE_PRODUCT,
CatalogProductTable::TYPE_SET,
CatalogProductTable::TYPE_OFFER,
CatalogProductTable::TYPE_SERVICE,
)
))
{
$this->productWithPrices[$id] = $id;
$this->calculatePrices[$id] = $id;
}
if (isset($this->productWithPrices[$id]))
{
if ($element['PRODUCT']['MEASURE'] > 0)
{
$element['ITEM_MEASURE'] = array(
'ID' => $element['PRODUCT']['MEASURE'],
'TITLE' => '',
'~TITLE' => ''
);
}
else
{
$element['ITEM_MEASURE'] = array(
'ID' => null,
'TITLE' => $this->storage['DEFAULT_MEASURE']['SYMBOL_RUS'],
'~TITLE' => $this->storage['DEFAULT_MEASURE']['~SYMBOL_RUS']
);
}
if ($enableCompatible)
{
$element['CATALOG_MEASURE'] = $element['ITEM_MEASURE']['ID'];
$element['CATALOG_MEASURE_NAME'] = $element['ITEM_MEASURE']['TITLE'];
$element['~CATALOG_MEASURE_NAME'] = $element['ITEM_MEASURE']['~TITLE'];
}
}
}
else
{
$element['PRICES'] = CIBlockPriceTools::GetItemPrices(
$element['IBLOCK_ID'],
$this->storage['PRICES'],
$element,
$this->arParams['PRICE_VAT_INCLUDE'],
$this->storage['CONVERT_CURRENCY']
);
if (!empty($element['PRICES']))
{
$element['MIN_PRICE'] = CIBlockPriceTools::getMinPriceFromList($element['PRICES']);
}
$element['CAN_BUY'] = !empty($element['PRICES']);
}
}