- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/compatible/eventcompatibility.php
- Класс: BitrixSaleCompatibleEventCompatibility
- Вызов: EventCompatibility::onBeforeBasketDelete
static function onBeforeBasketDelete(MainEvent $event)
{
if (static::$disableEvent === true)
{
return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}
$parameters = $event->getParameters();
/** @var SaleBasketItem $basketItem */
$basketItem = $parameters['ENTITY'];
if (!$basketItem instanceof SaleBasketItem)
{
return new MainEventResult(
MainEventResult::ERROR,
new SaleResultError(MainLocalizationLoc::getMessage('SALE_EVENT_COMPATIBILITY_WRONG_BASKET_ITEM'), 'SALE_EVENT_COMPATIBILITY_BEFORE_BASKET_ITEM_DELETE_WRONG_BASKET_ITEM'),
'sale'
);
}
$id = $basketItem->getId();
static::setDisableEvent(true);
foreach(GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_BEFORE_BASKET_DELETE, true) as $oldEvent)
{
if (ExecuteModuleEventEx($oldEvent, array($id)) === false)
{
return new MainEventResult(
MainEventResult::SUCCESS,
false,
'sale');
}
}
static::setDisableEvent(false);
return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}