<div class="foot_panel_2">
<?$APPLICATION->IncludeComponent("bitrix:sale.basket.basket.line", ".default",
array(
"PATH_TO_BASKET" => SITE_DIR."personal/cart/",
"PATH_TO_ORDER" => SITE_DIR."personal/order/make/",
"HIDE_ON_BASKET_PAGES" => "N",
"COUNT_DISCOUNT_4_ALL_QUANTITY" => "N",
),
false,
array("HIDE_ICONS" => "Y")
);?>
</div>
<?php
// Include Sale module
Bitrix\Main\Loader::includeModule("sale");
// Query: Get all cart items for current user
$res = CSaleBasket::GetList(
array(),
array(
"FUSER_ID" => CSaleBasket::GetBasketUserID(),
"LID" => SITE_ID,
"ORDER_ID" => NULL,
"CAN_BUY" => "Y"
),
false,
false,
array(
"QUANTITY",
"BASE_PRICE",
"PRICE",
"DISCOUNT_PRICE"
)
);
$totalPrice = 0;
// Temp array with cart items
$arItems = array();
// Fetching query
while($arFields = $res->Fetch()){
// Check for base price
if(!isset($arFields['BASE_PRICE']) || (float)$arFields['BASE_PRICE'] <= 0){
$arFields['BASE_PRICE'] = $arFields['PRICE'] + $arFields['DISCOUNT_PRICE'];
}
// Calculate total price without discount
$totalPrice += $arFields["PRICE"] * $arFields["QUANTITY"];
$arItems[] = $arFields;
}
// Make array for discount calculation
$arOrder = array(
'SITE_ID' => SITE_ID,
'ORDER_PRICE' => $totalPrice,
'BASKET_ITEMS' => $arItems
);
// Checking for authorized user
if(is_object($GLOBALS["USER"])){
$arOrder['USER_ID'] = $GLOBALS["USER"]->GetID();
$arErrors = array();
// Calculate discount
CSaleDiscount::DoProcessOrder($arOrder, array(), $arErrors);
}
// All done!
echo $arOrder['ORDER_PRICE'];