• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/product/b24catalog.php
  • Класс: Bitrix\Crm\Product\B24Catalog
  • Вызов: B24Catalog::updateSettings
static function updateSettings(): bool
	{
		$result = true;
		$catalogId = static::getDefaultId();
		if (!empty($catalogId))
		{
			$settings = static::getDefaultProductSettings();
			$fields = static::getDefaultFieldSettings();
			$data = [
				'LIST_MODE' => $settings['LIST_MODE'],
				'FIELDS' => [
					'CODE' => $fields['CODE'],
					'SECTION_CODE' => $fields['SECTION_CODE']
				]
			];

			$iblock = new \CIBlock();
			$iblockResult = $iblock->Update($catalogId, $data);

			if ($iblockResult)
			{
				$internalResult = static::applyDefaultRights($catalogId);
				if (!$internalResult->isSuccess())
				{
					$iblockResult = false;
				}
				unset($internalResult);
			}

			if ($iblockResult)
			{
				$iblockResult = self::createMorePhotoIfNotExists($catalogId);
			}

			if ($iblockResult)
			{
				$offerCatalogId = static::getDefaultOfferId();
				if ($offerCatalogId)
				{
					$internalResult = static::applyDefaultRights($offerCatalogId);
					if (!$internalResult->isSuccess())
					{
						$iblockResult = false;
					}
					unset($internalResult);
					if ($iblockResult)
					{
						$iblockResult = self::createMorePhotoIfNotExists($offerCatalogId);
					}
				}
			}

			if (!$iblockResult)
			{
				$result = false;
			}
			unset($iblockResult, $iblock);
			unset($data, $fields, $settings);
		}
		unset($catalogId);

		return $result;
	}