CCrmProductRestProxy::innerGet

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmProductRestProxy
  4. innerGet
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
  • Класс: \CCrmProductRestProxy
  • Вызов: CCrmProductRestProxy::innerGet
protected function innerGet($ID, &$errors)
{
	if(!CModule::IncludeModule('iblock'))
	{
		throw new RestException('Could not load iblock module.');
	}

	if(!CCrmProduct::CheckReadPermission($ID))
	{
		$errors[] = 'Access denied.';
		return false;
	}

	$catalogID = CCrmCatalog::GetDefaultID();
	if($catalogID <= 0)
	{
		$errors[] = 'Product is not found.';
		return null;
	}

	$filter = array('ID' => $ID, 'CATALOG_ID'=> $catalogID);
	$dbResult = CCrmProduct::GetList(array(), $filter, array('*'), array('nTopCount' => 1));
	$result = is_object($dbResult) ? $dbResult->Fetch() : null;
	if(!is_array($result))
	{
		$errors[] = 'Product is not found.';
		return null;
	}

	$this->initializePropertiesInfo($catalogID);
	$this->getProperties($catalogID, $result, array('PROPERTY_*'));

	return $result;
}

Добавить комментарий