diff --git a/index.php b/index.php index ae5c533..673eaac 100644 --- a/index.php +++ b/index.php @@ -60,33 +60,21 @@ $seats = json_decode(json_encode(unserialize($row2["places"], ['allowed_classes' //Convert object to HTML List $seat_html = ""; +$is_vip = false; +$vip_price = 0; + 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 $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 .= "
"; - } -} - //Build HTML Site, which will be converted into a PDF $data = ' @@ -126,7 +114,7 @@ $data = ' Zusätze - ' . $zusatz . ' + ' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . ' Name diff --git a/ticket-check.php b/ticket-check.php index a869a91..acf49ad 100644 --- a/ticket-check.php +++ b/ticket-check.php @@ -49,31 +49,16 @@ $seats = json_decode(json_encode(unserialize($row2["places"])), true); //Convert object to HTML List $seat_html = ""; + +$is_vip = false; +$vip_price = 0; + foreach ($seats as $seat) { - $seat_html .= $seat["place_name"] . " (" . $seat["place_price"] . "€), "; // results in e.g. 'Reihe 1, Platz 2 (5€)' -} - -//Generate Coupon Badge -$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 .= "
"; + 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"]; } } @@ -112,7 +97,7 @@ echo ' Zusätze - ' . $zusatz . ' + ' . ($is_vip ? "VIP (".$vip_price."€)" : "-") . ' Bestelldatum