-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCartItem.php
97 lines (66 loc) · 2.54 KB
/
CartItem.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
<?php
Class CartItem{
private $partID;
private $imageSrc;
private $partName;
private $partDesc;
private $stock;
private $price;
public function __construct($id, $imageSrc, $name, $desc, $stock, $price){
$this->partID = $id;
$this->partName = $name;
$this->partDesc = $desc;
$this->stock = $stock;
$this->price = $price;
$this->imageSrc = $imageSrc;
}
public function getID(){
return $this->partID;
}
public function getPrice(){
return $this->price;
}
public function displayItem(){
echo '
<div id = "cart-row" class = "row">
<div id = "inner-cart">
<div id = "imageCheck">
<div id = "check">
<input type = "checkbox" class = "sel" name = "partID[]" value = "'.$this->partID.'">
</div>
<div id = "image" >
<img src = '.$this->imageSrc.' class ="image-pic"></img>
</div>
</div>
<div id = "info">
<input type = "hidden" name = "partIDCheckout[]" value = "'.$this->partID.'"/>
<div id = "title">
<h2 class = "product">'.$this->partName.'</h2>
</div>';
echo '<div id = "stock">';
if($this->stock > 0){
echo '<span class = "in_stock">In Stock</span>';
}
else{
echo '<span class = "out_stock">Out of Stock</span>';
}
echo '
<div id = "price" class = "price">$'.$this->price.'</div>
</div>
<div id = "quantity">
<label for "quantity">Qty</label>
<select name = "quantity[]" id ="quantity">';
for($i = 1; $i <= $this->stock; $i++){
echo '<option value = '.$i.'>'.$i.'</option>';
}
echo'</select>
</div>
<div id ="delete">
<a id = "deleteLink" class = "deleteL" data='.urlencode($this->partID).' href = "delete_handler.php?pID='.urlencode($this->partID).'">Remove</a>
</div>
</div>
</div>
</div>
<hr></hr>';
}
}