-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
70 lines (65 loc) · 2.61 KB
/
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
session_start();
if (!isset($_SESSION['customer'])) {
header('Location: ./login.php');
}
require './class/product-link.class.php';
require './class/cart.class.php';
require './product-template.php';
$product_link = new product_link();
$cart = new cart();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="./asset/ressources/css/style.css">
<link rel="stylesheet" href="./asset/ressources/css/reset.css">
<title>Pear</title>
</head>
<body>
<?php require './view/partials/nav.php' ?>
<main role="main">
<div class="container">
<?php
$content = $cart->get_cart_content();
if (isset($content) && !empty($content)) {
echo '
<div class="text-center pt-2">
<button id="validateCart" type="button" class="btn btn-primary mx-auto">Passer commande</button>
<p id="totalPriceDisplay">Prix total du panier : '.$cart->get_cart_total_price().'€</p>
</div>
';
}
?>
<div class="row">
<div class="container pt-5">
<?php
$content = $cart->get_cart_content();
if (isset($content) && !empty($content)) {
foreach ($content as $item) {
$product = $product_link->get_product_from_id($item['id']);
product_in_cart($product);
}
} else {
echo "Le panier est vide !";
}
?>
</div>
</div>
</div>
</main>
<?php require './view/partials/footer.html' ?>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="./ajax/cart-manager.js"></script>
</body>
</html>