• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/ebay/ebayxmler.php
  • Класс: BitrixCatalogEbayEbayXMLer
  • Вызов: EbayXMLer::makeProductNode
public function makeProductNode($product)
{
	$dom = new DOMDocument('1.0', 'utf-8');

	$productNode = $dom->createElement('Product');

	foreach($this->fieldsMap as $bitrixFieldId => $ebayFieldPath)
	{
		if(isset($product[$bitrixFieldId]))
		{
			$arPath = $this->parsePath($ebayFieldPath);

			$newNode = $oldNewNode = null;

			foreach($arPath as $pathItem)
			{
				if(!$this->isChildExist($productNode, $pathItem))
				{
					$newNode = $dom->createElement($pathItem);

					if($oldNewNode)
						$oldNewNode->appendChild($newNode);
					else
						$productNode->appendChild($newNode);

					$oldNewNode = $newNode;
				}
			}

			if($newNode)
				$newNode->nodeValue = $product[$bitrixFieldId];
		}
	}

	return $dom->saveXML($productNode);
}