• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/ebay/catalogsectiontabhandler.php
  • Класс: BitrixSaleTradingPlatformEbayCatalogSectionTabHandler
  • Вызов: CatalogSectionTabHandler::saveCategoryMap
protected function saveCategoryMap($bitrixCategoryId, $iblockId, array $ebayCategoriesIds, $params = array())
{
	$result = true;
	$catMapEntId = MapHelper::getCategoryEntityId($iblockId);


	foreach($ebayCategoriesIds as $ebayCategoryId)
	{
		if(trim($ebayCategoryId) == '')
			continue;

		$fields = array(
			"ENTITY_ID" => $catMapEntId,
			"VALUE_INTERNAL" => $bitrixCategoryId
		);

		$dbRes = MapTable::getList(array(
			'filter' => $fields
		));

		$fields["VALUE_EXTERNAL"] = $ebayCategoryId;
		if(!empty($params))
			$fields["PARAMS"] = $params;

		if($map = $dbRes->fetch())
			$res = MapTable::update($map['ID'], $fields);
		else
			$res = MapTable::add($fields);

		$result = $result && $res->isSuccess();
	}

	return $result;
}