public static function bestelregelToevoegen($arrBestelRegel, $productID, $aantal) { /* returnt arrBestelRegel met toegevoegd of updated regel.*/ $dubbel = bestelRegelService::checkAlBesteld($arrBestelRegel, $productID, $aantal); if (!$dubbel) { $objRegel = new Bestelregel($productID, $aantal); array_push($arrBestelRegel, $objRegel); return $arrBestelRegel; die; } return $dubbel; }
<?php if (isset($_GET['product']) && isset($_GET['aantal'])) { $_SESSION['bestelregelarray'] = bestelRegelService::bestelregelAanpassen($_SESSION['bestelregelarray'], $_GET['product'], $_GET['aantal']); } $arrBestelRegel = $_SESSION['bestelregelarray']; $karNietLeeg = bestelRegelService::winkelkarNietLeeg($arrBestelRegel); if (!$karNietLeeg) { header("Location: index.php?page=bestelling"); die; } ?> <div class="wrapper clearfix"> <div class="txtC"> <h1>Uw bestelling wijzigen.</h1> - <a href="?page=bestelling&winkelkar=leeg">Anuleren</a> - <a href="?page=bestelling">Verder winkelen</a> - <a href="?page=afrekenen&winkelkar=afrekenen">Afrekenen</a> - </div> <div class="innercontainer"> <dl> <dt>Winkelmandje aanpassen</dt> <?php $totprijs = 0; foreach ($arrBestelRegel as $regel) { $productID = $regel->productID; $aantal = $regel->aantal; $product = productService::getProductFromId($productID); $productPrijs = $product->prijs; $prijs = $aantal * $productPrijs; if ($aantal) {
$klant = klantService::getKlantFromId($klantID); $dbDatum = $bestelling->Besteldatum; $datum = date('d-m-Y', strtotime($dbDatum)); $BestelID = $bestelling->BestelID; $klantnaam = $klant->Naam . " " . $klant->VNaam; if ($nextdatum == "") { print $datum . "<hr/>"; } else { if ($nextdatum != $dbDatum) { print "<hr/>" . $datum . "<hr/>"; } } print "<div class='innercontainer txtL'> "; print "<dl><dt>Bestelling voor " . $klantnaam . " op " . $datum . "</dt>"; $totPrijs = $bestelling->Prijs; $arrBestelRegel = bestelRegelService::getBestelRegelsFromId($BestelID); foreach ($arrBestelRegel as $regel) { $productID = $regel->productID; $aantal = $regel->aantal; $product = productService::getProductFromId($productID); $productPrijs = $product->prijs; $prijs = $aantal * $productPrijs; if ($aantal) { print "<dd>" . $aantal . " x " . $product->product . " <strong>€ " . $productPrijs . "</strong> = € " . $prijs . "</dd>"; } } print "<dt>Totaalprijs = € " . $totPrijs . "</dt>"; print "</dl><a href='?page=overzicht&verwijder=" . $BestelID . "'>bestelling verwijderen</a>"; print "</div>"; $nextdatum = $dbDatum; }
<?php if (isset($_GET['winkelkar']) && $_GET['winkelkar'] == 'leeg') { unset($_SESSION['bestelregelarray']); header("Location: index.php?page=bestel"); die; } if (!isset($_GET['product']) && !isset($_SESSION['bestelregelarray'])) { header("Location: index.php?page=bestel"); die; } if (isset($_GET['product']) && $_GET['page'] == 'bestelling') { $IDproduct = productService::getProductFromId($_GET['product']); if (isset($_GET['aantal'])) { $_SESSION['bestelregelarray'] = bestelRegelService::bestelregelToevoegen($_SESSION['bestelregelarray'], $_GET['product'], $_GET['aantal'], '1'); } } if (isset($_SESSION['bestelregelarray']) && !empty($_SESSION['bestelregelarray']) || isset($_GET['product']) && $_GET['page'] == 'bestelling') { if (!isset($_GET['aantal']) && isset($_GET['product'])) { ?> <div class="wrapper clearfix"> <div class="txtC"> <h1>Hoeveel <?php print $IDproduct->categorie; ?> had u gewenst?</h1> <form action="index.php" method="get"> <input type="hidden" name="page" value="bestelling"> <input type="hidden" name="product" value="<?php print $IDproduct->id; ?>