• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discountcouponsmanagerbase.php
  • Класс: BitrixSaleDiscountCouponsManagerBase
  • Вызов: DiscountCouponsManagerBase::deleteApplyByProduct
static function deleteApplyByProduct($product)
{
	if (self::$useMode == self::MODE_SYSTEM || empty($product))
		return false;
	$hash = self::getProductHash($product);
	if ($hash === '')
		return false;
	$success = false;
	foreach (self::$coupons as &$oneCoupon)
	{
		if ($oneCoupon['STATUS'] == self::STATUS_NOT_FOUND || $oneCoupon['STATUS'] == self::STATUS_FREEZE)
			continue;
		if ($oneCoupon['SAVED'] == 'Y')
			continue;
		if (isset($oneCoupon['BASKET'][$hash]))
		{
			unset($oneCoupon['BASKET'][$hash]);
			if (empty($oneCoupon['BASKET']) && empty($oneCoupon['DELIVERY']))
				$oneCoupon['STATUS'] = self::STATUS_NOT_APPLYED;
			$success = true;
		}
	}
	unset($oneCoupon);
	return $success;
}