if (isset($_GET["action"])) { if ($_GET["action"] == "afrekenen") { } if ($_GET["action"] == "bestel") { $tijdstip = date("Y-m-d H:i:s"); $totaalprijs = $_SESSION["totaalprijs"]; /* Voeg bestelling en bestregs toe */ if ($_SESSION["aangemeld"] == true) { //voor klanten uit DB $ksvc = new KlantService(); $klant = $ksvc->haalKlantOp($_SESSION["email"]); $bsvc = new BestellingService(); $bsvc->voegBestellingToe($klant->getKlantId(), $tijdstip, $totaalprijs, $_POST["koerierinfo"]); } else { //voor niet geregistreerde klanten $bsvc = new BestellingService(); $klantId = null; $bsvc->voegBestellingToe($klantId, $tijdstip, $totaalprijs, $_POST["koerierinfo"]); } unset($_SESSION["aangemeld"]); unset($_SESSION["winkelmandje"]); unset($_SESSION["naam"]); unset($_SESSION["voornaam"]); unset($_SESSION["straat"]); unset($_SESSION["postcode"]); unset($_SESSION["gemeente"]); unset($_SESSION["telefoon"]); unset($_SESSION["email"]); unset($_SESSION["wijzig"]); header("location:aanbodController.php"); exit(0);
$promo = $promosvc->haalPromo($pizza->getPizzaId()); if (isset($promo)) { $verschil = $pizza->getPrijs() - $promo->getPromoprijs(); $_SESSION["totaalprijs"] -= $verschil; $_SESSION["promo"] = $promo; } } } header("location:afrekenenController.php"); exit(0); } } if ($_GET["action"] == "bestel") { $tijdstip = date("Y-m-d H:i:s"); $totaalprijs = $_SESSION["totaalprijs"]; $bsvc = new BestellingService(); /* * Voeg bestelling en bestregs toe */ if ($_SESSION["aangemeld"] == true) { //voor geregistreerde klanten $ksvc = new KlantService(); $klant = $ksvc->haalKlantOp($_SESSION["email"]); $_SESSION["bestellingId"] = $bsvc->voegBestellingToe($klant->getKlantId(), $tijdstip, $totaalprijs, $_POST["koerierinfo"]); } else { //voor niet geregistreerde klanten $_SESSION["bestellingId"] = $bsvc->voegBestellingToe(null, $tijdstip, $totaalprijs, $_POST["koerierinfo"]); } /* * Voeg bestelregels toe, check voor prijs of de pizza overeenkomt met promo */