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