Answer the question
In order to leave comments, you need to log in
Bitrix quick order, how to get shipping cost?
Tell me how to get the shipping cost at the time of sending an email with a quick order?
quick order on a component from Aspro.
Hooking on the quick order event
$eventManager = Bitrix\Main\EventManager::getInstance();
$eventManager->addEventHandler("main", "OnBeforeEventAdd", array('OrderMailModify', 'OneClickBuyModify'));
public function OneClickBuyModify($event, &$siteId, &$arFields){
if ($event != 'NEW_ONE_CLICK_BUY'){
return true;
}
$order = \Bitrix\Sale\Order::load($arFields['RS_ORDER_ID']);
$shipmentCollection = $order->getShipmentCollection();
$arFields['PRICE_DELIVERY'] = $shipmentCollection->getBasePriceDelivery();
Answer the question
In order to leave comments, you need to log in
I will answer myself
public function OneClickBuyModify($event, &$siteId, &$arFields){
if ($event != 'NEW_ONE_CLICK_BUY'){
return true;
}
if(class_exists('\Bitrix\Sale\Internals\OrderTable')){
$arOrder = \Bitrix\Sale\Internals\OrderTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('ID' => $arFields['RS_ORDER_ID'])))->Fetch();
}
else{
$arOrder = CSaleOrder::GetList(array(), array('ID' => $arFields['RS_ORDER_ID']))->Fetch();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question