- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/propertyindex/element.php
- Класс: BitrixIblockPropertyIndexElement
- Вызов: Element::loadElementPrices
protected function loadElementPrices(array $productList)
{
$priceList = BitrixCatalogPriceTable::getList(array(
'select' => array('ID', 'PRODUCT_ID', 'CATALOG_GROUP_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'),
'filter' => array('@PRODUCT_ID' => $productList)
));
while($price = $priceList->fetch())
{
if (!isset($this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]]))
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]] = array();
$priceValue = (float)$price["PRICE"];
$this->elementPrices[$price["CATALOG_GROUP_ID"]][$price["CURRENCY"]][(string)$priceValue] = $priceValue;
}
unset($price);
unset($priceList);
foreach ($this->elementPrices as $catalogGroupId => $currencyPrices)
{
foreach ($currencyPrices as $currency => $prices)
{
if (count($prices) > 2)
{
$this->elementPrices[$catalogGroupId][$currency] = array(
min($prices),
max($prices),
);
}
}
unset($currency, $prices);
}
unset($catalogGroupId, $currencyPrices);
}