ported Additions to VIP
This commit is contained in:
parent
e289f45945
commit
4b449dc277
2 changed files with 20 additions and 47 deletions
32
index.php
32
index.php
|
@ -60,33 +60,21 @@ $seats = json_decode(json_encode(unserialize($row2["places"], ['allowed_classes'
|
||||||
//Convert object to HTML List
|
//Convert object to HTML List
|
||||||
$seat_html = "";
|
$seat_html = "";
|
||||||
|
|
||||||
|
$is_vip = false;
|
||||||
|
$vip_price = 0;
|
||||||
|
|
||||||
foreach ($seats as $seat) {
|
foreach ($seats as $seat) {
|
||||||
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
|
if($seat["place_name"]!="VIP"){
|
||||||
|
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
|
||||||
|
}else{
|
||||||
|
$is_vip=true;
|
||||||
|
$vip_price=$seat["place_price"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Generate Coupon Badge
|
//Generate Coupon Badge
|
||||||
$rabatt = ($row2["coupon_id"]!=0) ? $row2["zbc_code"] . ' (-' . $row2["zbc_discount"].'€)' : "-";
|
$rabatt = ($row2["coupon_id"]!=0) ? $row2["zbc_code"] . ' (-' . $row2["zbc_discount"].'€)' : "-";
|
||||||
|
|
||||||
$zusatz = "";
|
|
||||||
|
|
||||||
//converting [1,2,3] to (1,2,3) => sql syntax
|
|
||||||
$ids = str_replace("[","(",$row2["additional_ids"]);
|
|
||||||
$ids = str_replace("]",")",$ids);
|
|
||||||
|
|
||||||
//Get all used additional services
|
|
||||||
$statement_additional = $pdo->prepare("SELECT * from zf_bap_additional WHERE additional_id IN ".$ids);
|
|
||||||
|
|
||||||
//Execute Statement and fetch Data
|
|
||||||
$statement_additional->execute();
|
|
||||||
$row_additional = $statement_additional->fetchAll();
|
|
||||||
|
|
||||||
foreach ($row_additional as $item){
|
|
||||||
$zusatz .= $item["name"]." (".$item["price_eur"]."€)";
|
|
||||||
if(count($row_additional)>1){
|
|
||||||
$zusatz .= "<br/>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Build HTML Site, which will be converted into a PDF
|
//Build HTML Site, which will be converted into a PDF
|
||||||
$data = '<!doctype html>
|
$data = '<!doctype html>
|
||||||
<html lang="de-AT">
|
<html lang="de-AT">
|
||||||
|
@ -126,7 +114,7 @@ $data = '<!doctype html>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td_desc">Zusätze</td>
|
<td class="td_desc">Zusätze</td>
|
||||||
<td>' . $zusatz . '</td>
|
<td>' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . '</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td_desc">Name</td>
|
<td class="td_desc">Name</td>
|
||||||
|
|
|
@ -49,31 +49,16 @@ $seats = json_decode(json_encode(unserialize($row2["places"])), true);
|
||||||
|
|
||||||
//Convert object to HTML List
|
//Convert object to HTML List
|
||||||
$seat_html = "";
|
$seat_html = "";
|
||||||
|
|
||||||
|
$is_vip = false;
|
||||||
|
$vip_price = 0;
|
||||||
|
|
||||||
foreach ($seats as $seat) {
|
foreach ($seats as $seat) {
|
||||||
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
|
if($seat["place_name"]!="VIP"){
|
||||||
}
|
$seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)'
|
||||||
|
}else{
|
||||||
//Generate Coupon Badge
|
$is_vip=true;
|
||||||
$rabatt = ($row2["coupon_id"]!=0) ? $row2["zbc_code"] . ' (-' . $row2["zbc_discount"].'€)' : "-";
|
$vip_price=$seat["place_price"];
|
||||||
|
|
||||||
|
|
||||||
$zusatz = "";
|
|
||||||
|
|
||||||
//converting [1,2,3] to (1,2,3) => sql syntax
|
|
||||||
$ids = str_replace("[","(",$row2["additional_ids"]);
|
|
||||||
$ids = str_replace("]",")",$ids);
|
|
||||||
|
|
||||||
//Get all used additional services
|
|
||||||
$statement_additional = $pdo->prepare("SELECT * from zf_bap_additional WHERE additional_id IN ".$ids);
|
|
||||||
|
|
||||||
//Execute Statement and fetch Data
|
|
||||||
$statement_additional->execute();
|
|
||||||
$row_additional = $statement_additional->fetchAll();
|
|
||||||
|
|
||||||
foreach ($row_additional as $item){
|
|
||||||
$zusatz .= $item["name"]." (".$item["price_eur"]."€)";
|
|
||||||
if(count($row_additional)>1){
|
|
||||||
$zusatz .= "<br/>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +97,7 @@ echo '<html>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td_desc">Zusätze</td>
|
<td class="td_desc">Zusätze</td>
|
||||||
<td>' . $zusatz . '</td>
|
<td>' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . '</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td_desc">Bestelldatum</td>
|
<td class="td_desc">Bestelldatum</td>
|
||||||
|
|
Loading…
Reference in a new issue