-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart-item.php
170 lines (141 loc) · 4.86 KB
/
cart-item.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
#20111213 #1581:sougata
#20111213 #1581:sougata
#20111214 #1581:sougata
#201201160211 #1631:sougata
$bookings = $hotel->getElementsByTagName('booking');
foreach ($bookings as $booking)
{
$roomType = $booking->getElementsByTagName('roomtype')->item(0);
$rate = $booking->getElementsByTagName('rate')->item(0);
$addons = $rate->getElementsByTagName('addon');
#20111215:arup #1581 add booking policy node
$bookingNode = $booking->getElementsByTagName('bookingpolicy')->item(0);
?>
<tr>
<td>
<?php echo $roomType->getAttribute('title'); ?>
</td>
<td>
<span>
<?php echo
$rate->getAttribute('title'); ?>
</span>
<?php
$descrt = $rate->getElementsByTagName('description')->item(0)->nodeValue;
if($descrt)
{
echo "<br><font color=green size=2>Description :".$descrt."</font>";
}
?>
<span>
<?php
$incls = $rate->getElementsByTagName('inclusion');
$inclIdsArr=array();
if ($incls->item(0))
{
echo '<br>Inclusions: ';
foreach ($incls as $incl)
{
$inclIdsArr[] = $incl->getAttribute('id');
echo '<span>' . $incl->getAttribute('title') . '</span>, ';
}
}
?>
</span>
<span>
<?php
$ams = $roomType->getElementsByTagName('amenity');
if ($ams->item(0))
{
echo '<br>Amenities: ';
$amstr ='';
foreach ($ams as $am)
{
$amstr.=$am->getAttribute('title').", ";
}
echo '<span>' . rtrim($amstr,", ") . '</span>';
}
?>
</span>
<?php
$addonIdsArr =array();
if ($addons->item(0))
{
$addStr = '';
foreach ($addons as $addon)
{
$addStr.=$addon->getAttribute("title") . ", ";
$addonIdsArr[]=$addon->getAttribute("id");
}
?>
Add-Ons: <span><?php echo rtrim($addStr,', '); ?></span>
<?php
}
?>
</td>
<td>
<?php
echo displayDate($booking->getAttribute('checkindate')) . " to " . displayDate($booking->getAttribute('checkoutdate'));
?>
</td>
<td>
Adults:
<?php echo $booking->getAttribute('adult'); ?>
Children:
<?php echo $booking->getAttribute('child'); ?>
<!-- <tr>
<td align="left">Infant:</td>
<td align="left">
<?php echo $booking->getAttribute('infant'); ?>
</td>
</tr> -->
</td>
<td>
<?php echo displayPrice($rate->getAttribute('price'), $currCode); ?>
</td>
<td style="text-align:center;">
1
</td>
<td width="20%">
<?php
$total=$rate->getAttribute('price')+$rate->getAttribute('tax');
echo displayPrice($rate->getAttribute('price'), $currCode);
echo "<br>Tax: ".displayPrice($rate->getAttribute('tax'), $currCode);
echo "<br/>".createBookingPolicyStr($bookingNode, $currCode);
?>
<?php
if ($addons->item(0))
{
$addTotPrice=0;
$addTotTax=0;
foreach ($addons as $addon)
{
$addTotPrice+=$addon->getAttribute("price");
$addTotTax+=$addon->getAttribute("tax");
}
?>
<div>
Add-Ons:
<?php
echo displayPrice($addTotPrice, $currCode);
echo "<br>Add-Ons Tax: ". displayPrice($addTotTax, $currCode);
$total=$total+$addTotPrice+$addTotTax;
?>
</div>
<?php
}
$_SESSION['total']=$total;
$addInclArr = array_merge($inclIdsArr,$addonIdsArr);
$attachedIncls = implode(',', $addInclArr);
?>
</td>
<td>
<a href="<?php echo site_url(); ?>/delete-cart-item?itemId=<?php echo $booking->getAttribute('id'); ?>" class="table-button"> Remove </a>
<br />
<br />
<a href="javascript:void(0);" class="table-button addonbtn"
onclick="openWin('<?php echo $booking->getAttribute('id'); ?>','<?php echo $attachedIncls; ?>')" > Add-Ons </a>
</td>
<?php
}