forked from parthshahk/Electronics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
101 lines (86 loc) · 5.32 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
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
<?php
<section class="item-cards">
<div class="container">
<div class="row">
<?php
$rows = $cardObject->fetchAll();
foreach($rows as $row){
$inCart = 0;
foreach ($_SESSION['cart'] as $object) {
if($object['id'] == $row['ID']){
$inCart = 1;
break;
}
}
?>
<?php
if($inCart){
?>
<script>
document.addEventListener('DOMContentLoaded', function(){
modifyInCart(<?php echo $row['ID'] ?>);
});
</script>
<?php
}
?>
<div class="col xl3 m4 s12">
<div class="card grey lighten-3">
<div class="card-image">
<img class="activator" src="<?php echo BaseAddress; ?>/images/products/<?php echo $row['ID']; ?>.0.jpg" alt="<?php echo $row['Full Name']; ?>">
<a id="item<?php echo $row['ID']; ?>" class="btn-floating halfway-fab red <?php echo $row['Stock Status'] ? '' : 'hide'; ?>" onclick="addToCart('<?php echo $row['ID']; ?>')">
<i class="fa fa-cart-plus" aria-hidden="true" id="icon<?php echo $row['ID']; ?>"></i>
</a>
<a class="btn-floating halfway-fab light-blue <?php echo $row['Stock Status'] ? 'hide' : ''; ?>" href="item.php?q=<?php echo $row['ID']; ?>#notify">
<i class="fa fa-bell" aria-hidden="true"></i>
</a>
</div>
<div class="card-content">
<span class="card-title activator grey-text text-darken-4 truncate">
<?php echo $row['Short Name']; ?>
<i class="fa fa-ellipsis-v right hide-on-med-and-up" aria-hidden="true"></i>
</span>
<p class="blue-text <?php echo $row['Stock Status'] ? '' : 'hide'; ?>">Rs. <?php echo $row['Selling Price']; ?> <strike class="grey-text">Rs. <?php echo $row['Original Price']; ?>
</strike>
<?php $per = round(($row['Original Price'] - $row['Selling Price'])/ $row['Original Price']*100);
echo "<div class='green-text text-darken-2 light'> </div>
<h6>$per % off
</h6>" ?>
</p>
<p class='red-text'><?php echo $row['Stock Status'] ? '' : 'OUT OF STOCK'; ?></p>
</div>
<div class='card-reveal'>
<span class='card-title grey-text text-darken-4'><?php echo $row['Full Name']; ?><i class="fa fa-times right" aria-hidden="true"></i></span>
<p>
<?php
if($row['Description']!='-'){ // If description exists then show description
echo $row['Description'];
}else if($row['Specifications']!='-'){ // Else if Specifications
echo "<ul>";
$pieces=explode("*",$row['Specifications']);
for($j=0;$j<sizeof($pieces);$j++){
echo "<li>".$pieces[$j]."</li>";
}
echo "</ul>";
}else if($row['Kit Contents']!='-'){ // Else Kit Contents
echo "<ul>";
$pieces=explode("*",$row['Kit Contents']);
for($j=0;$j<sizeof($pieces);$j++){
echo "<li>".$pieces[$j]."</li>";
}
echo "</ul>";
}
?>
</p><p>Open product page for technical details.</p>
</div>
<div class='card-action'>
<a href='item.php?q=<?php echo $row['ID']; ?>' class='blue-text truncate'>Open Page</a>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</section>