• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/AgentContract/Manager.php
  • Класс: BitrixCatalogv2AgentContractManager
  • Вызов: Manager::deleteProductsByContractId
static function deleteProductsByContractId(int $id): MainResult
{
	$result = new MainResult();

	$agentProductIterator = CatalogAgentProductTable::getList([
		'select' => ['ID'],
		'filter' => ['=CONTRACT_ID' => $id],
	]);
	while ($agentProduct = $agentProductIterator->fetch())
	{
		$deleteProductResult = CatalogAgentProductTable::delete($agentProduct['ID']);
		if (!$deleteProductResult->isSuccess())
		{
			$result->addErrors($deleteProductResult->getErrors());
		}
	}

	return $result;
}