-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
66 lines (64 loc) · 3.09 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
<?php
include './src/inc/cart.inc.php';
?>
<?=template_header('Cart')?>
<div class="container">
<div class="cart content-wrapper">
<h1>Voziček</h1>
<form action="./index.php?page=cart" method="post">
<table>
<thead>
<tr>
<td colspan="2">Izdelek</td>
<td>Cena</td>
<td>Količina</td>
<td>Skupaj</td>
</tr>
</thead>
<tbody>
<?php if (empty($products)): ?>
<tr>
<td class="cart-empty" colspan="5" style="text-align: center;">Ni izdelkov v košarici.</td>
</tr>
<?php else: ?>
<?php foreach ($products as $product): ?>
<tr>
<td class="img">
<a href="./index.php?page=product&id=<?=$product['id']?>">
<?php $images = get_image($product['id']);
if($images): ?>
<img src="<?=$images[0]['image']?>" alt="<?=$images[0]['caption']?>"
class="card-img-top hvrbox-layer_bottom img-thumbnail">
<?php else: ?>
<img src="https://via.placeholder.com/210x190" alt="placeholder-image"
class="card-img-top hvrbox-layer_bottom img-thumbnail">
<?php endif; ?>
</a>
</td>
<td>
<a href="./index.php?page=product&id=<?=$product['id']?>"><?=$product['title']?></a>
<br>
<a href="./index.php?page=cart&remove=<?=$product['id']?>" class="remove">Odstrani</a>
</td>
<td class="price"><?=retail_price($product['id'])?> €</td>
<td class="quantity">
<input type="number" name="quantity-<?=$product['id']?>" value="<?=$products_in_cart[$product['id']]?>" min="1" max="<?=$product['quantity']?>" placeholder="Quantity" required>
</td>
<td class="price"><?=retail_price($product['id']) * $products_in_cart[$product['id']]?> €</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
<div class="subtotal">
<span class="text">Skupna cena:</span>
<span class="price"><?=$subtotal?> €</span>
</div><!-- subtotal -->
<div class="buttons">
<input type="submit" value="Posodobi" name="update">
<input type="submit" value="naroči" name="placeorder">
</div><!-- buttons -->
</form>
</div><!-- cart content-wrapper -->
</div><!-- container -->
<?=template_footer()?>