<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList" %>
<%@page import="model.CartMod" %>
<%@page import="model.CartProduct" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href='images/style.css' type=text/css>
<title>Gio hang</title>
</head>
<body>
<%
Object obj=session.getAttribute("giohang");

// Hien Thi Gio Hang Neu Chua co Session
if (obj==null) {%>
<table background="images/bgmenu.gif">
<tr><td><img  src="images/bullet_tiny.gif" width="15" height="10"><font color="red"> 0</font> Sản Phẩm</td><td>
<img src="images/carticon.png" width="82" height="80"></td></tr></table>
<% } 
//Ket Thuc Gio Hang Neu Chua co Session

else{
CartMod giohang=(CartMod)obj;
ArrayList<CartProduct> Listpd=giohang.getGiohang();
double amount = giohang.Tongtien();
%>
<% if(Listpd.size() > 0){ %>
<%
	int sosanpham = 0;
    for(CartProduct pd:Listpd){
    	sosanpham = sosanpham + pd.getSoluong();
        }
        %>
<table background="images/bgmenu.gif">
<tr><td><img  src="images/bullet_tiny.gif" width="15" height="10"><span style="cursor: pointer;" onclick="location.href = 'index.jsp?customer=mycart'" title="Xem Giỏ Hàng"><font color="red"> <%= sosanpham  %></font></span> Sản Phẩm<br>
<img  src="images/bullet_tiny.gif" width="15" height="10"> <span style="cursor: pointer;" onclick="location.href = 'index.jsp?customer=mycart'" title="Xem Giỏ Hàng"><font color="red"><%=Math.round(amount)%></font></span> đ<br>
<img  src="images/bullet_tiny.gif" width="15" height="10"> <a onclick="return ajaxlog();" href="Cart?rep=checkout" title="Thanh Toán Giỏ Hàng">Thanh Toán</a>
</td><td>
<a href="index.jsp?customer=mycart"><img border="0" src="images/carticon.png" width="82" height="80" title="Xem Giỏ Hàng"></a></td></tr></table>

<% } else {%>
<table background="images/bgmenu.gif">
<tr><td><img  src="images/bullet_tiny.gif" width="15" height="10"><font color="red"> 0</font> Sản Phẩm</td><td>
<img src="images/carticon.png" width="82" height="80"></td></tr></table>
 <%}} %>
</body>
</html>