forked from pipspritam/Full-Stack-Shopping-website-with-jsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwishlist.jsp
72 lines (61 loc) · 2.21 KB
/
wishlist.jsp
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
<%@ include file="dbconnect.jsp" %>
<%@ include file="navbar.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
<link rel="stylesheet" href="./css/wishlist.css">
<title>Document</title>
</head>
<%
String email = (String)session.getAttribute("email");
Statement stmt1=con.createStatement();
Statement stmt2=con.createStatement();
ResultSet rs1=stmt1.executeQuery("select * from wishlist where email = '" + email + "'");
boolean flag = false;
%>
<body>
<div class="container">
<div class="box">
<h2>My Wishlist</h2>
<%
while(rs1.next())
{
flag = true;
ResultSet rs2=stmt2.executeQuery("select * from item where product_id = '" + rs1.getString(2) + "'");
rs2.next();
int discountPrice = (rs2.getInt(3)*(100 - rs2.getInt(6)))/100;
String imgName = rs2.getString(1) + ".jpg";
String img_path = "./image/";
%>
<form class="item" method="POST">
<img src="<%= img_path+imgName %>" alt="./image/product-1.jpg" onerror="this.onerror=null; this.src='./image/default.jpg'">
<div class="details">
<h3><%= rs2.getString("product_name") %></h3>
<div class="price">
<h1><span>₹</span><%=discountPrice %></h1>
<strike><span>₹</span><%= rs2.getInt(3) %></strike>
<p><%= rs2.getInt(6) %>% Off</p>
</div>
<div class="btn-div">
<input type="hidden" name="ID" value="<%= rs1.getString(2) %>">
<button formaction="./buy_now.jsp">Buy Now</button>
<button formaction="./add_to_cart.jsp">Add To Cart</button>
</div>
</div>
<button class="delete fas fa-trash" formaction="./remove_from_wishlist.jsp">
</button>
</form>
<%
}
if(!flag)
{
%>
<h1>Wishlist is empty!</h1>
<%
}
%>
</div>
</div>
</body>
</html>