diff --git a/index.php b/index.php index fb6b729..7bcf847 100644 --- a/index.php +++ b/index.php @@ -67,6 +67,26 @@ foreach ($seats as $seat) { //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 = ' @@ -104,6 +124,10 @@ $data = ' Ticket-Nummer ' . $row2["order_id"] . "_" . $row2["code"] . ' + + Zusätze + ' . $zusatz . ' + Name ' . sonderzeichen($row2["first_name"]) . " " . sonderzeichen($row2["last_name"]) . ' diff --git a/ticket-check.php b/ticket-check.php index 54695cd..a869a91 100644 --- a/ticket-check.php +++ b/ticket-check.php @@ -56,6 +56,27 @@ foreach ($seats as $seat) { //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 .= "
"; + } +} + echo ' @@ -89,6 +110,10 @@ echo ' Name ' . $row2["first_name"] . " " . $row2["last_name"] . ' + + Zusätze + ' . $zusatz . ' + Bestelldatum ' . $row2["date"] . '