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

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