<%@ page import="hotspace.servlet.http.HSCookie, hotspace.util.HSUtil, hotspace.model.exception.NotFoundException, hotspace.rt.handler.shop.CheckCart, hotspace.service.*, hotspace.sql.DB, com.dcx.db.*" %> <%@ page import="org.apache.commons.logging.LogFactory"%> <%@ page import="org.apache.commons.logging.Log"%> <%@ page import="org.hibernate.Session"%> <%@ page import="com.dcx.hibernate.HibernateUtil"%> <%! /* Declarations for this JSP */ private static Log _scblog = LogFactory.getLog( "shoppingcartbutton/checkcart.jsp" ); %> <% if( request.getParameter( "hideCart" ) == null || !request.getParameter( "hideCart" ).equals( "1" ) ) { // see if you have a cookie RequestInterface req = Request.getInstance( request ); HSCookie cookie = new HSCookie( req, response ); if( cookie.getPersistentCookieId() == null ) { // _scblog.error( "No cart found for: " + req.getServerName() ); } else { try { int storeId = Integer.parseInt( "1518" ); String hideCart = null; ShopBasket basket = new ShopBasket( cookie.getPersistentCookieId(), "www.decentrix.com", storeId ); Session dbSession = HibernateUtil.getSession( DB.DBNAME_DEFINER ); basket = (ShopBasket)dbSession.load( ShopBasket.class, basket ); if( basket != null ) { OrderEntity order = basket.getPendingOrder(); if( HSUtil.avail( hideCart ) ) ; else out.println( formatCartButton( req, order.getOrderEntries().size() ) ); } else _scblog.error( "Could not load cart: " + cookie.getPersistentCookieId() ); } catch( Exception ex ) { _scblog.error( "Failed to build shopping cart.", ex ); // Print nothing. we have had a problem constructing the cart. out.println( "" ); } } } %> <%! public String formatCartButton( RequestInterface request, int itemCount ) { StringBuilder result = new StringBuilder(); if (itemCount > 0) { result.append( "
  "); result.append( "You have " ); result.append( String.valueOf( itemCount ) ); result.append( " item" ); if( itemCount != 1 ) result.append( "s" ); result.append( " in your shopping cart   " ); String href = null; String origin = request.getScheme() + "://" + request.getServerName() + ":" + ( request.getServerPort() == 80 ? "" : String.valueOf( request.getServerPort() ) ) + request.getRequestURI(); href = "_cart.jsp?origin=" + origin + "&hideCart=1"; result.append( "" ); result.append( " View Cart / Checkout" ); result.append( "" ); result.append( "  
" ); } return result.toString(); } %>
Korean Symbol for "YO"
Yo
.
Thank you for your interest in my web site. To request further information, please enter your request on the form below.

If you require an answer within 24 hours, please telephone 303-324-2632.

*Email is checked regularly. To avoid any delays, call me.


Comment Type
Your comments
Your Name
Telephone
Email
Check this box if you feel the need.
Here is another box for you to check if you wish.
Note, this denotes a field that requires input. To ensure your form will be submitted to us successfully, please enter or select information for all of these required fields.