Бронирование чайных

parent 99e47d1e
......@@ -54,6 +54,8 @@ foreach($arResult["ADDRESS"] as $k=>$adress) {
}
// добавляем чайные
$arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_PRICE");
$arItem=[];
if ($k==9){
$add=24;
......@@ -66,7 +68,6 @@ foreach($arResult["ADDRESS"] as $k=>$adress) {
);
$res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arSelect = array("ID", "IBLOCK_ID", "NAME", "PROPERTY_*");
$arItem = $ob->GetFields();
$arResult["ADDRESS"][$k]['ITEMS'][] = $arItem;
......
......@@ -35,9 +35,12 @@
<div class="quest__title addr-quests berezka">
<div class="quest__title-text"><?=$arItem['NAME']?></div>
</div>
<?if ($arItem['IBLOCK_ID']==7){?>
<?if ($arItem['IBLOCK_ID']==7){
?>
<div class="slots tt_v1__slots">
<? $time="11:00";
$price=$arItem['PROPERTY_PRICE_VALUE'];
for ($i = 0; $i <= 24; $i++) {
$ti=explode(":",$time);
$hour=(int)$ti[0];
......
......@@ -260,22 +260,28 @@ function teaBron($time,$date,$questId){
return $teas;
}
function closedTea($date,$time,$teaId){
function closedTea($date,$time,$teaId)
{
// получаем бронирование чайных
$iblockId=13;
$arSelect = Array("ID", "IBLOCK_ID","PROPERTY_*");
$iblockId = 13;
$arSelect = array("ID", "IBLOCK_ID", "PROPERTY_*");
$date = date('Y-m-d', strtotime($date));
$arFilter = Array(
"IBLOCK_ID"=>$iblockId,
"ACTIVE"=>"Y",
"PROPERTY_TEA"=>$teaId,
"PROPERTY_DATE"=>$date
$teas = [];
$arFilter = array(
"IBLOCK_ID" => $iblockId,
"ACTIVE" => "Y",
"PROPERTY_TEA" => $teaId,
"PROPERTY_DATE" => $date
);
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement()) {
$res = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($ob = $res->GetNextElement()) {
$arItem = $ob->GetFields();
$arItem['PROPERTIES'] = $ob->GetProperties();
$teas[]=$arItem;
}
$t=[];
foreach ($teas as $arItem) {
$hourBeg = explode(':', $arItem['PROPERTIES']['TIME_BEGIN']['VALUE']);
$hourBegin = $hourBeg[0];
$minBegin = $hourBeg[1];
......@@ -284,17 +290,33 @@ function closedTea($date,$time,$teaId){
$minEnd = $hourEn[1];
$hou = explode(':', $time);
$hour = $hou[0];
$min=$hou[0];
$min = $hou[1];
// если время брони совпадает
if ($hour >= $hourBegin && $hour < $hourEnd) {
return true;
} elseif ($time==$arItem['PROPERTIES']['TIME_END']['VALUE']) {
return true;
} else return false;
if ($hour > $hourBegin && $hour < $hourEnd) {
$t[]="close";
break;
} elseif ($hour==$hourEnd && $min <= $minEnd) {
$t[]="close";
break;
} elseif ($hour==$hourBegin && $min >= $minBegin) {
$t[]="close";
break;
}
else {
$t[]="open";
}
}
if (in_array("close",$t)){
return true;
} else return false;
}
//формирование списка времени для чайных
function timeend($tim,$teaId,$date)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment