• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/elementlist.php
  • Класс: BitrixIblockComponentElementList
  • Вызов: ElementList::modifyDisplayProperties
protected function modifyDisplayProperties($iblock, &$iblockElements)
{
	if (!empty($iblockElements))
	{
		$iblockParams = $this->storage['IBLOCK_PARAMS'][$iblock];
		$propertyCodes = $iblockParams['PROPERTY_CODE'];
		$productProperties = $iblockParams['CART_PROPERTIES'];
		$getPropertyCodes = !empty($propertyCodes);
		$getProductProperties = $this->arParams['ADD_PROPERTIES_TO_BASKET'] === 'Y' && !empty($productProperties);
		$getIblockProperties = $getPropertyCodes || $getProductProperties;

		if ($getIblockProperties || ($this->useCatalog && $this->useDiscountCache))
		{
			$propFilter = array(
				'ID' => array_keys($iblockElements),
				'IBLOCK_ID' => $iblock
			);
			CIBlockElement::GetPropertyValuesArray($iblockElements, $iblock, $propFilter);

			if ($getPropertyCodes)
			{
				$propertyList = $this->getPropertyList($iblock, $propertyCodes);
			}

			foreach ($iblockElements as &$element)
			{
				if ($this->useCatalog && $this->useDiscountCache)
				{
					if ($this->storage['USE_SALE_DISCOUNTS'])
						CatalogDiscountDiscountManager::setProductPropertiesCache($element['ID'], $element["PROPERTIES"]);
					else
						CCatalogDiscount::SetProductPropertiesCache($element['ID'], $element['PROPERTIES']);
				}

				if ($getIblockProperties)
				{
					if (!empty($propertyList))
					{
						foreach ($propertyList as $pid)
						{
							if (!isset($element['PROPERTIES'][$pid]))
								continue;

							$prop =& $element['PROPERTIES'][$pid];
							$isArr = is_array($prop['VALUE']);
							if (
								($isArr && !empty($prop['VALUE']))
								|| (!$isArr && (string)$prop['VALUE'] !== '')
								|| Tools::isCheckboxProperty($prop)
							)
							{
								$element['DISPLAY_PROPERTIES'][$pid] = CIBlockFormatProperties::GetDisplayValue($element, $prop);
							}
							unset($prop);
						}
						unset($pid);
					}

					if ($getProductProperties)
					{
						$element['PRODUCT_PROPERTIES'] = CIBlockPriceTools::GetProductProperties(
							$iblock,
							$element['ID'],
							$productProperties,
							$element['PROPERTIES']
						);

						if (!empty($element['PRODUCT_PROPERTIES']))
						{
							$element['PRODUCT_PROPERTIES_FILL'] = CIBlockPriceTools::getFillProductProperties($element['PRODUCT_PROPERTIES']);
						}
					}
				}
			}
			unset($element);

			CIBlockFormatProperties::clearCache();
			Tools::clearCache();
		}
	}
}