-
Notifications
You must be signed in to change notification settings - Fork 0
/
removeFromCart.jsp
83 lines (77 loc) · 2.89 KB
/
removeFromCart.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
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="java.util.ArrayList"%>
<%@ page import="product.*"%>
<%@ page import="shoppingCart.*"%>
<head>
<title>View Cart</title>
<link rel="icon" type="image/png" href="css/images/favicon-16x16.png" sizes="16x16" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="all" />
<script type="text/javascript" src="js/searchProduct.js"></script>
</head>
<%
int productID = Integer.parseInt(request.getParameter("productID"));
String productSize = request.getParameter("productSize");
cart ekart;
ekart = (cart) session.getAttribute("cart");
ekart.deleteFromCart(productID,productSize);
session.setAttribute("cart", ekart);
ekart = (cart) session.getAttribute("cart"); %>
<body onload="init()">
<!-- Shell -->
<div class="shell">
<%@include file="global/header.jsp"%> <!-- include from gloabl -->
<div id="main">
<div class="cl"> </div>
<!-- Content -->
<div id="content">
<br>
<% if(ekart==null )
{%>
<h1>Cart is Empty </h1>
<%}
else
{
ArrayList<productBean> Items= ekart.getCartItems();
if(Items.isEmpty())
{%>
<h1>Cart is Empty </h1>
<%}
else
{%>
<form action='checkout.jsp'>
<table style="width:100%" frame='box' rules='rows'>
<tr><td></td><td>Product Name</td><td>Price</td><td>Size</td><td>Quantity</td><td></td></tr>
<%
int totalCartPrice=0;
for(int i=0;i<Items.size();i++)
{
productBean productdata = (productBean)Items.get(i) ;
totalCartPrice+=productdata.getProductPrice()*productdata.getProductPurchaseQuantity();%>
<tr><td><img src="css/images/img_<%=productdata.getProductID()%>.jpg" width = '75' height = '75'>
<td><%=productdata.getProductName()%></td>
<td>$<%=productdata.getProductPrice()%></td>
<td><%=productdata.getProductSize()%></td>
<td><%=productdata.getProductPurchaseQuantity()%></td>
<td><a href='removeFromCart.jsp?productID=<%=productdata.getProductID()%>&productSize=<%=productdata.getProductSize()%>'>Remove From Cart</a> </td>
</tr>
<%}%>
<tr>
<td align="center" colspan='6'> <h2> Total Amount : $<%=totalCartPrice%> </h2></td>
</tr>
<tr ><td align='center' colspan='6'>
<input type="submit" class="search-submit" name="Submit" value= "CheckOut" /></td></tr>
</form>
</table>
<%}
}%>
</div>
<!-- End Content -->
<%@include file="global/sidebar.jsp"%>
</div>
<!-- End Main -->
<%@include file="global/footer.jsp"%>
<!-- End Shell -->
</body>
</html>