-
Notifications
You must be signed in to change notification settings - Fork 0
/
component.php
85 lines (62 loc) · 3.33 KB
/
component.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
<?php
function component($productname, $productprice, $productimg, $productid){
$element = "
<div class=\"col-md-3 col-sm-6 my-3 my-md-0\">
<form action=\"index.php\" method=\"post\">
<div class=\"card shadow\">
<div>
<img src=\"$productimg\" alt=\"Image1\" class=\"img-fluid card-img-top\">
</div>
<div class=\"card-body\">
<h5 class=\"card-title\">$productname</h5>
<h6>
<i class=\"fas fa-star\"></i>
<i class=\"fas fa-star\"></i>
<i class=\"fas fa-star\"></i>
<i class=\"fas fa-star\"></i>
<i class=\"far fa-star\"></i>
</h6>
<p class=\"card-text\">
Some quick example text to build on the card.
</p>
<h5>
<small><s class=\"text-secondary\">$519</s></small>
<span class=\"price\">$$productprice</span>
</h5>
<button type=\"submit\" class=\"btn btn-warning my-3\" name=\"add\">Add to Cart <i class=\"fas fa-shopping-cart\"></i></button>
<input type='hidden' name='product_id' value='$productid'>
</div>
</div>
</form>
</div>
";
echo $element;
}
function cartElement($productimg, $productname, $productprice, $productid){
$element = "
<form action=\"cart.php?action=remove&id=$productid\" method=\"post\" class=\"cart-items\">
<div class=\"border rounded\">
<div class=\"row bg-white\">
<div class=\"col-md-3 pl-0\">
<img src=$productimg alt=\"Image1\" class=\"img-fluid\">
</div>
<div class=\"col-md-6\">
<h5 class=\"pt-2\">$productname</h5>
<small class=\"text-secondary\">Seller: dailytuition</small>
<h5 class=\"pt-2\">$$productprice</h5>
<button type=\"submit\" class=\"btn btn-warning\">Save for Later</button>
<button type=\"submit\" class=\"btn btn-danger mx-2\" name=\"remove\">Remove</button>
</div>
<div class=\"col-md-3 py-5\">
<div>
<button type=\"button\" class=\"btn bg-light border rounded-circle\"><i class=\"fas fa-minus\"></i></button>
<input type=\"text\" value=\"1\" class=\"form-control w-25 d-inline\">
<button type=\"button\" class=\"btn bg-light border rounded-circle\"><i class=\"fas fa-plus\"></i></button>
</div>
</div>
</div>
</div>
</form>
";
echo $element;
}