-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreview.php
124 lines (114 loc) · 3.28 KB
/
preview.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php include 'inc/header.php';?>
<?php
if(!isset($_GET['proid']) || $_GET['proid'] == NULL){
echo "<script>window.location = '404.php';</script>";
}else{
$id = $_GET['proid'];
}
?>
<?php
$brand = new Brand();
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['submit'])){
$quantity = $_POST['quantity'];
$addCart = $ct -> addToCart($quantity,$id);
}
?>
<?php
$cmrId = Session::get("customerId");
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['compare'])){
$productId = $_POST['productId'] ;
$insertcompare = $pd -> insertCompareData($productId, $cmrId);
}
?>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['wlist'])){
$savelist = $pd -> insertWishlist($id, $cmrId);
}
?>
<style>
.mybutton{float: left;margin-right: 50px;width: 100px}
.add-cart {padding-top: 0px;margin-top: 35px;}
</style>
<div class="main">
<div class="content">
<div class="section group">
<div class="cont-desc span_1_of_2">
<?php
$getPd = $pd ->getSingleProduct($id);
if($getPd){
while ($result = $getPd ->fetch_assoc()) {
?>
<div class="grid images_3_of_2">
<img src="admin/<?php echo $result['image'] ;?>" alt="" />
</div>
<div class="desc span_3_of_2">
<h2><?php echo $result['productName'] ;?></h2>
<div class="price">
<p>Price: <span><?php echo $result['price'] ;?></span></p>
<p>Category: <span><?php echo $result['catName'] ;?></span></p>
<p>Brand:<span><?php echo $result['brandName'] ;?></span></p>
</div>
<div class="add-cart">
<form action="" method="post">
<input type="number" class="buyfield" name="quantity" value="1"/>
<input type="submit" class="buysubmit" name="submit" value="Buy Now"/>
</form>
</div>
<span style="color:red;font-size:18px;">
<?php
if(isset($addCart)){
echo $addCart;
}
?>
</span>
<?php
if(isset($insertcompare)){
echo $insertcompare;
}
if(isset($savelist)){
echo $savelist;
}
?>
<?php
$login = Session::get('customerlogin');
if($login == true){
?>
<div class="add-cart">
<div class="mybutton">
<form action="" method="post">
<input type="hidden" class="buyfield" name="productId" value="<?php echo $result['productId'] ;?>"/>
<input type="submit" class="buysubmit" name="compare" value="Add to Compare"/>
</form>
</div>
</div>
<div class="add-cart">
<div class="mybutton">
<form action="" method="post">
<input type="submit" class="buysubmit" name="wlist" value="Add to Wishlist"/>
</form>
</div>
</div>
<?php } ?>
</div>
<div class="product-desc">
<h2>Product Details</h2>
<?php echo $result['body'] ;?>
</div>
<?php } } ?>
</div>
<div class="rightsidebar span_3_of_1">
<h2>CATEGORIES</h2>
<ul>
<?php
$getcat = $cat ->getAllCat();
if($getcat){
while ($result = $getcat ->fetch_assoc()) {
?>
<li><a href="productbycat.php?catid=<?php echo $result['catId'];?>"><?php echo $result['catName'];?></a></li>
<?php } } ?>
</ul>
</div>
</div>
</div>
</div>
<?php include 'inc/footer.php';?>