• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/copy/implement/element.php
  • Класс: BitrixIblockCopyImplementElement
  • Вызов: Element::convertPropertyId
private function convertPropertyId(array $fields, $targetIblockId)
{
	$targetProperties = [];
	$queryObject = CIBlockProperty::getList([], ["IBLOCK_ID" => $targetIblockId]);
	while ($property = $queryObject->fetch())
	{
		$targetProperties[$property["ID"]] = $property["CODE"];
	}

	foreach ($fields["PROPERTY_VALUES"] as $propertyId => $propertyValue)
	{
		$queryObject = CIBlockProperty::getList([], ["ID" => $propertyId]);
		if ($property = $queryObject->fetch())
		{
			foreach ($targetProperties as $targetPropertyId => $targetPropertyCode)
			{
				if ($targetPropertyCode == $property["CODE"])
				{
					$fields["PROPERTY_VALUES"][$targetPropertyId] = $propertyValue;
				}
			}
			unset($fields["PROPERTY_VALUES"][$propertyId]);
		}
	}

	return $fields;
}