-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
149 lines (115 loc) · 6.86 KB
/
index.php
File metadata and controls
149 lines (115 loc) · 6.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
// Uit deze php bestanden gebruiken wij functies of variabelen:
include_once("app/authentication.php"); // Accounts en login
include_once("app/vendor.php"); // wordt gebruikt voor website beschrijving
include_once("app/database.php"); // wordt gebruikt voor database connectie
include_once("app/model/categorie.php"); // wordt gebruikt voor categorieen ophalen uit DB
include_once("app/model/product.php"); // wordt gebruikt voor producten ophalen uit DB
include_once("app/mediaportal.php"); // wordt gebruikt voor categorie foto's
?>
<!doctype html>
<html class="no-js" lang="">
<head>
<?php
//Hier include je de head-tag-template, alles wat in de header komt pas je aan in "tpl/head-tag-template.php"
include("tpl/head-tag-template.php");
?>
</head>
<body>
<!-- Onze website werkt niet met Internet Explorer 9 en lager-->
<!--[if IE]>
<div id="warning" class="fixed-top"><p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please upgrade your browser to improve your experience and security.</p></div>
<![endif]-->
<!-- Hierin -->
<div id="pagina-container">
<!-- Print de header (logo, navigatiebalken, etc.)-->
<?php
include("tpl/header_template.php");
?>
<!-- Inhoud pagina -->
<div class="content-container-home">
<div id="product-sectie" class="d-flex flex-row">
<?php
//Als de sales template klaar is kunnen we de comments hier onder weghalen en dan worden de sales bovenaan de pagina geladen.
//include("tpl/sale_template.php");
// Alle SQL magie en PDO connectie shit gebeurt in `Product::read()` dus in deze file hebben we geen queries meer nodig. We kunnen direct lezen van de statement zoals hieronder.
// De volgende code laadt de 16 eerste producten in de DB en geeft ze weer:
$stmt = (Product::read(Database::getConnection(), 16));
// Per rij die we uit de database halen voeren we een stukje code uit
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
// Dit zorgt er voor dat we `$StockItemID` enzo kunnen gebruiken (PHPStorm geeft rood streepje aan maar het werkt wel)
extract($row);
//"perfect" ~ Matthijs Bakker - 19/11/2019 16:02
?>
<!-- Print dit resultaat -->
<div class="product-display d-flex">
<!-- Maakt alles klikbaar zodat de gebruiker naar de pagina gestuurd wordt -->
<a href="product.php?id=<?php print($StockItemID) ?>">
<div class="product-foto">
<!-- Kijkt of het product een foto in de database heeft, zo niet dan geeft hij de categoriefoto -->
<img src="data:image/png;base64, <?php
if (isset($Photo) && $Photo != null) {
print($Photo);
} else {
print(MediaPortal::getCategoryImage($StockItemID));
}
?>">
</div>
<div class="beschikbaar-button w-100">
<?php if($Tags === '["Limited Stock"]'){ ?>
<button class="btn btn-danger btn-lg" style="width: 100%"> Beperkt beschikbaar koop nu!</button>
<?php } ?>
</div>
<div class="product-beschrijving">
<h4><?php print($StockItemName) ?></h4>
<p><?php print($SearchDetails) ?></p>
<div class="product-prijs">
<h5>
€<?php printf("%0.2f",$RecommendedRetailPrice * (1 + $TaxRate / 100)); ?>
</h5>
</div>
<form method="POST" name="winkelmandje" action="">
<input type="hidden"
name="product:<?php print($StockItemID); ?>"
value="1"
class="form-control"
/>
<input type="submit"
class="WinkelwagenKnop btn btn-primary
<?php
if (isset($_POST["product:" . $StockItemID])) {
print("btn-success");
} else {
print("bootstrap-btn");
}
?>
"
value="<?php
if (isset($_POST["product:" . $StockItemID])) {
print("Toegevoegd!");
} else {
print("Toevoegen aan winkelwagentje");
}
?>"
/>
<input type="hidden"
name="csrf_token"
value="<?php print($csrf_token);?>"
/>
</form>
</div>
</a>
</div>
<?php
}
?>
</div>
</div>
</div>
<div class="footer-container">
<?php
include("tpl/footer_template.php");
?>
</div>
</body>
</html>