出于某种原因,当我显示预订引擎的结果时,它显示的结果如下:
主房间
主房间 2
主房间
主房间 2
备用房间
备用房间 2
备用房间
备用房间 2
它应该显示为:
主房间
主房间 2
备用房间
备用房间 2
希望有人能明白为什么它会因此翻倍。
<?php
$array_rooms =null;
if (get_user_meta(get_current_user_id(),'admin',true)) {
$admin = true;
} else {
$admin = false;
}
?>
<head>
</head>
<body id="results">
<h1>Available <em>Rooms</em></h1>
<table>
<?php
if($array_rooms != null){
foreach($array_rooms as $key=>$room) {
$special = '';
$roomRatePlanID = 119;
if($key==0){
$room['desc'] = "Main Room";
$special = '&whp=1';
$roomRatePlanID = 68;
}
if($key==1){
$room['desc'] = "Main Room 2";
$special = '&whp=1';
$roomRatePlanID = 68;
}
if($key==2){
$room['desc'] = "Spare Room";
$special = '&whp=1';
$roomRatePlanID = 68;
}
if($key==3){
$room['desc'] = "Spare Room 2";
$special = '&whp=1';
$roomRatePlanID = 68;
}
?>
<tr<?php if (!get_user_meta(get_current_user_id(),'admin',true) && strpos($room['desc'],'Main Room') !== false) echo ' class="disabled"'; ?>>
<td>
<div>
<h2><a href="/rooms/" target="_blank"><?php echo $room['desc'] ." " . $room['available'] ;?></a></h2>
<div><?php
if ($room['desc'] == "Main Room"){
echo "<strong>Rate: $89.00</strong>';
}elseif(($room['desc'] == "Main Room 2")){
echo "<strong>$79.00</strong>";
} else{
if ($admin)
$netrate = number_format($room['rates'][119],2);
else
$netrate = number_format($room['rates'][20] - ($room['rates'][20] / 100 * get_user_meta(get_current_user_id(),'package',true)),2);
echo "Customer Rate: <strong>$".number_format($room['rates'][20],2).'</strong> / Net Rate: <strong>$'.$netrate.'</strong>';
}?></div>
<div><a href="/book/summary?roomTypeCode=<?php echo $room['roomTypeCode'] . $special;?>">Book</a></div>
</div>
</td>
</tr>
<tr<?php if (!get_user_meta(get_current_user_id(),'admin',true) && strpos($room['desc'],'Main Room') !== false) echo ' class="disabled"'; ?>>
<td>
<div>
<h2><a href="/rooms/" target="_blank"><?php echo $room['desc'] ." " . $room['available'] ;?></a></h2>
<div><?php
if ($room['desc'] == "Spare Room"){
echo "<strong>Rate: $59.00</strong>';
}elseif(($room['desc'] == "Spare Room 2")){
echo "<strong>$49.00</strong>";
} else{
if ($admin)
$netrate = number_format($room['rates'][119],2);
else
$netrate = number_format($room['rates'][21] - ($room['rates'][21] / 100 * get_user_meta(get_current_user_id(),'package',true)),2);
echo "Customer Rate: <strong>$".number_format($room['rates'][20],2).'</strong> / Net Rate: <strong>$'.$netrate.'</strong>';
}?></div>
<div><a href="/book/summary?roomTypeCode=<?php echo $room['roomTypeCode'] . $special;?>">Book</a></div>
</div>
</td>
</tr>
<?php } }else{ echo 'no results'; }?>
</body>
</html>