• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/cml2.php
  • Класс: CIBlockCMLImport
  • Вызов: CIBlockCMLImport::GetElementByXML_ID
function GetElementByXML_ID($IBLOCK_ID, $XML_ID)
{
	if($XML_ID == '')
		return false;
	if (!isset($this->arElementCache[$IBLOCK_ID]))
		$this->arElementCache[$IBLOCK_ID] = array();
	if (!isset($this->arElementCache[$IBLOCK_ID][$XML_ID]))
	{
		$obElement = new CIBlockElement;
		$rsElement = $obElement->GetList(
				array('ID' => 'ASC'),
				array("=XML_ID" => $XML_ID, "IBLOCK_ID" => $IBLOCK_ID),
				false, false,
				array("ID", "XML_ID")
		);
		if($arElement = $rsElement->Fetch())
			$this->arElementCache[$IBLOCK_ID][$XML_ID] = $arElement["ID"];
		else
			$this->arElementCache[$IBLOCK_ID][$XML_ID] = false;
	}

	return $this->arElementCache[$IBLOCK_ID][$XML_ID];
}