• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/model/product.php
  • Класс: BitrixCatalogModelProduct
  • Вызов: Product::checkSubscription
static function checkSubscription($id, array $product): void
{
	if (
		isset($product[self::PREFIX_OLD.'AVAILABLE'])
		&& CatalogSubscribeTable::checkPermissionSubscribe($product['SUBSCRIBE'])
	)
	{
		if (
			$product[self::PREFIX_OLD.'AVAILABLE'] == CatalogProductTable::STATUS_NO
			&& $product['AVAILABLE'] == CatalogProductTable::STATUS_YES
		)
		{
			CatalogSubscribeTable::runAgentToSendNotice($id);
		}
		elseif (
			$product[self::PREFIX_OLD.'AVAILABLE'] == CatalogProductTable::STATUS_YES
			&& $product['AVAILABLE'] == CatalogProductTable::STATUS_NO
		)
		{
			CatalogSubscribeTable::runAgentToSendRepeatedNotice($id);
		}
		if (
			$product[self::PREFIX_OLD.'QUANTITY'] <= 0
			&& $product['QUANTITY'] > 0
		)
		{
			if (self::$saleIncluded === null)
				self::$saleIncluded = Loader::includeModule('sale');
			if (self::$saleIncluded)
				CSaleBasket::ProductSubscribe($id, 'catalog');
		}
	}
}