-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshopping-cart.php
executable file
·54 lines (42 loc) · 1.78 KB
/
shopping-cart.php
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
<?php
require_once 'bootstrap.php';
$templateParams["title"] = "Shopping cart";
$templateParams["name"] = "shopping-cart-template.php";
$final_products = $_SESSION["final_products"] ?? [];
$templateParams["total_price"] = 0.0;
foreach ($final_products as &$final_product) {
$title = $final_product["title"];
$print = $dbh->getPictureFromTitle($title);
if(!empty($print)) {
$print = $print[0];
$technique_id = intval($final_product["technique_id"], 10);
$frame_id = intval($final_product["frame_id"], 10);
$passpartout_id = intval($final_product["passpartout_id"], 10);
if ($technique_id == 0) {
$final_product["technique"] = "none";
} else {
$final_product["technique"] = $dbh->getTechniqueFromId($technique_id)[0]["Description"];
}
if ($frame_id == 0) {
$final_product["frame"] = "none";
} else {
$final_product["frame"] = $dbh->getFrameFromId($frame_id)[0]["Description"];
}
if ($passpartout_id == 0) {
$final_product["passpartout"] = "none";
} else {
$final_product["passpartout"] = $dbh->getPasspartoutFromId($passpartout_id)[0]["Specifications"];
}
$final_product["image"] = $print["Image"];
$templateParams["total_price"] += $final_product["price"];
}
}
unset($final_product);
if (isUserLoggedIn(UserType::Customer)) {
$templateParams["logged"] = true;
} else {
$templateParams["logged"] = false;
}
$templateParams["final_products"] = $final_products;
require 'template/base.php';
?>