• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Integration/Landing/StoreV3Master.php
  • Класс: BitrixCatalogv2IntegrationLandingStoreV3Master
  • Вызов: StoreV3Master::addNewStore
static function addNewStore(): Result
{
	$result = new Result();

	if (!Loader::includeModule('landing'))
	{
		return $result->addError(new Error('Failed to load module 'landing'.'));
	}

	if (self::limitExceeded())
	{
		if (!self::hasUnusedStores())
		{
			return $result->addError(new Error('Store limit exceeded.'));
		}

		$res = self::deactivateUnusedStore();
		if (!$res->isSuccess())
		{
			return $result->addErrors($res->getErrors());
		}

		$result->setData($res->getData());
	}

	self::createStore();

	if (!self::hasStore())
	{
		$result->addError(new Error('Failed to create a new store.'));
	}

	return $result;
}