• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/product/basket.php
  • Класс: BitrixCatalogProductBasket
  • Вызов: Basket::fillOfferProperties
static function fillOfferProperties(array &$propertyList, $id, $iblockId)
{
	static $properties = [];

	$skuInfo = CCatalogSku::GetInfoByOfferIBlock($iblockId);
	if (empty($skuInfo))
		return;
	$skuPropertyId = $skuInfo['SKU_PROPERTY_ID'];
	$parentIblockId = $skuInfo['PRODUCT_IBLOCK_ID'];
	unset($skuInfo);

	if (!isset($properties[$iblockId]))
	{
		$properties[$iblockId] = [];
		$iterator = IblockPropertyTable::getList([
			'select' => [
				'ID',
				'CODE',
			],
			'filter' => [
				'=IBLOCK_ID' => $iblockId,
				'=ACTIVE' => 'Y',
				'@PROPERTY_TYPE' => [
					IblockPropertyTable::TYPE_ELEMENT,
					IblockPropertyTable::TYPE_LIST,
					IblockPropertyTable::TYPE_STRING,
				],
				'=MULTIPLE' => 'N',
			],
			'order' => [
				'ID' => 'ASC',
			]
		]);
		while ($row = $iterator->fetch())
		{
			$row['ID'] = (int)$row['ID'];
			if ($row['ID'] == $skuPropertyId)
				continue;
			$properties[$iblockId][] = $row['CODE'] ?? $row['ID'];
		}
		unset($row, $iterator);
	}
	if (empty($properties[$iblockId]))
		return;

	$offerProperties = CIBlockPriceTools::GetOfferProperties(
		$id,
		$parentIblockId,
		$properties[$iblockId]
	);
	unset($parentIblockId, $skuPropertyId);

	if (empty($offerProperties))
		return;

	$codeMap = [];
	if (!empty($propertyList))
	{
		foreach ($propertyList as $row)
		{
			if (!isset($row['CODE']))
				continue;
			$index = (string)$row['CODE'];
			if ($index === '')
				continue;
			$codeMap[$index] = true;
		}
		unset($index, $row);
	}
	foreach ($offerProperties as $row)
	{
		$index = (string)$row['CODE'];
		if (isset($codeMap[$index]))
			continue;
		$codeMap[$index] = true;
		$propertyList[] = $row;
	}
	unset($index, $row, $codeMap, $offerProperties);
}