123456789101112131415161718192021222324252627282930313233343536373839 |
- <?
- require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php");
- $APPLICATION->SetTitle("Тест");
- ?>
- <p><?
- CModule::IncludeModule('iblock');
- \Bitrix\Main\UI\Extension::load("ui.alerts");
- $IBLOCK_ID = 4;
- define("NOT_CHECK_PERMISSIONS", true);
- $arBask = json_decode($_COOKIE['basket']);
- $arBasket = array();
- foreach ($arBask as $object) {
- array_push($arBasket, $object->id);
- }
- $arBasketFilter = ["ID" => $arBasket];
- $arFilter = Array("IBLOCK_ID"=>4, "ID"=>$arBasket);?>
-
- <?$arSelect = Array("ID", "IBLOCK_ID", "NAME", "DATE_ACTIVE_FROM","PROPERTY_*");//IBLOCK_ID и ID обязательно должны быть указаны, см. описание arSelectFields выше
- $res = CIBlockElement::GetList(Array(), $arFilter, false, Array("nPageSize"=>50), $arSelect);
- $wth_discount = 0;
- $sum = 0;
- while($ob = $res->GetNextElement()){
- $arFields = $ob->GetFields();
- $arProps = $ob->GetProperties();
- if ($arProps["DISCOUNT"]["VALUE"]){
- $new_price = $arProps["PRICE"]["VALUE"] - ($arProps["PRICE"]["VALUE"] * $arProps["DISCOUNT"]["VALUE"] / 100);
- $wth_discount+=$new_price;
- }
- else{
- $wth_discount+=$arProps["PRICE"]["VALUE"];
- }
- $sum+=$arProps["PRICE"]["VALUE"];
- }?>
- <h3><?=$sum;?> <?=$wth_discount;?></h3>
- <? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php"); ?>
|