Examples of ShoppingCart


Examples of Java.Shoppingcart

      out.write("        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
      out.write("        <title>Winkelwagen</title>\n");
      out.write("        <script src=\"include/jquery-1.9.1.min.js\"></script>\n");
      out.write("        <link href=\"css/main.css\" rel=\"stylesheet\" />\n");
      out.write("        ");
  Shoppingcart cart = null;
            String username = (String)session.getAttribute("username");
            if(username == null || !DatabaseKoppeling.checkUsername(username)) {
                response.sendRedirect("loguit.jsp");
            }
       
      out.write("\n");
      out.write("            \n");
      out.write("        ");

            String currencyparam = (String) request.getParameter("value");
            String currency = (String)session.getAttribute("cur");
            if(currencyparam != null) {
                currency = currencyparam;
                session.setAttribute("cur", currency);
            }
            String curCurrency;
            if("usd".equals(currency))
            {
                currency = "USD";
                session.setAttribute("currentCurrency", currency);
                curCurrency = "USD";
            }
            else
            {
                currency = "EUR";
                session.setAttribute("currentCurrency", currency);
                curCurrency = "EUR";
            }
       
      out.write("\n");
      out.write("        <style>\n");
      out.write("            table#shoppingcart {\n");
      out.write("                width:100%;\n");
      out.write("            }\n");
      out.write("            \n");
      out.write("            #shoppingcart th {\n");
      out.write("                border-bottom:2px solid gray;\n");
      out.write("            }\n");
      out.write("            \n");
      out.write("            #shoppingcart tr td {\n");
      out.write("                border-bottom: 1px solid gray;\n");
      out.write("            }\n");
      out.write("            \n");
      out.write("            a.menu {\n");
      out.write("                float:right; \n");
      out.write("                border:2px white; \n");
      out.write("                background: none;\n");
      out.write("            }\n");
      out.write("\n");
      out.write("            a.menu img {\n");
      out.write("                padding-left: 10px;\n");
      out.write("            }\n");
      out.write("\n");
      out.write("            a.menu:hover {\n");
      out.write("                margin-top: -10px;\n");
      out.write("                padding: 10px;\n");
      out.write("                background: black;\n");
      out.write("            }\n");
      out.write("            span.menubutton {\n");
      out.write("                display: none;\n");
      out.write("            }\n");
      out.write("        </style>\n");
      out.write("        \n");
      out.write("        <script>\n");
      out.write("            function showusermenu() {\n");
      out.write("                $(\".menubutton\").css(\"display\", \"block\");\n");
      out.write("            }\n");
      out.write("            \n");
      out.write("            function hideusermenu() {\n");
      out.write("                $(\".menubutton\").css(\"display\", \"none\");\n");
      out.write("            }\n");
      out.write("        </script>\n");
      out.write("    </head>\n");
      out.write("    <body>\n");
      out.write("        <div id=\"header\">\n");
      out.write("            <a href=\"index.jsp\">Startpagina</a>\n");
      out.write("            <a href=\"mainpage.jsp\">Home</a> \n");
      out.write("            <a href=\"c_shoppingcart.jsp\" style=\"color:#ffffff;\">Winkelwagen</a>\n");
      out.write("            <a href=\"c_orders.jsp\">Bestellingen</a>\n");
      out.write("            <a style='float:right; margin-right: 22%; text-align: right;' class=\"unselectable menu\" \n");
      out.write("               onmouseover=\"Javascript:showusermenu();\"\n");
      out.write("               onmouseout='Javascript:hideusermenu();'>");
      out.print(username);
      out.write("<br>\n");
      out.write("                <span onclick=\"Javascript:location.href='ServletChangeType?newtype=Photographer';\" class=\"menubutton\">\n");
      out.write("                    Photographer\n");
      out.write("                </span>\n");
      out.write("                <span onclick=\"Javascript:location.href='loguit.jsp';\" class=\"menubutton\">Log uit</span>\n");
      out.write("            </a>\n");
      out.write("            <a id=\"cur_eur\" href=\"c_shoppingcart.jsp?value=eur\" style=\"float:right;\">€</a>\n");
      out.write("            <a id=\"cur_dol\" href=\"c_shoppingcart.jsp?value=usd\" style=\"float:right;\">$</a>\n");
      out.write("        </div>\n");
      out.write("        <div id=\"content\">\n");
      out.write("            <br>\n");
      out.write("            <h1>Winkelwagen</h1>         \n");
      out.write("            \n");
      out.write("                <form action=\"ServletUpdateCookie\" method=\"post\">\n");
      out.write("                <table id =\"shoppingcart\">\n");
      out.write("                    <tr>\n");
      out.write("                        <th>Foto Nummer</th>\n");
      out.write("                        <th>Product</th>\n");
      out.write("                        <th>Kleur</th>\n");
      out.write("                        <th>Stukprijs</th>\n");
      out.write("                        <th>Aantal</th>\n");
      out.write("                        <th>Prijs</th>\n");
      out.write("                        <th>Verwijderen</th>\n");
      out.write("                    </tr>\n");
      out.write("                    ");

                    cart = new Shoppingcart();
                    Cookie[] cookies = request.getCookies();
                    if (cookies != null) {
                        for (Cookie c : cookies) {
                            if (c.getName().equals("SHOPPINGCART")) {
                                    cart = new Shoppingcart(c.getValue());
                                    break;
                            }
                        }
                    }
                    cart.sort();
                    String curSymbol = "€";
                    double totalprice = 0.0;
                    session.setAttribute("carttoupdate", cart);
                    for (int i = 0; i < cart.size(); i++) {
                        ShoppingcartItem item = cart.get(i);
                        int amount = item.getAmount();
                        String photo = item.getPhoto();
                        double price = 0.00;
                        if("USD".equals(curCurrency))
                        {
View Full Code Here

Examples of Shop.ShoppingCart

   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetShoppingCart(ShoppingCart newShoppingCart, NotificationChain msgs) {
    ShoppingCart oldShoppingCart = shoppingCart;
    shoppingCart = newShoppingCart;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ShopPackage.CUSTOMER__SHOPPING_CART, oldShoppingCart, newShoppingCart);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here

Examples of cart.ShoppingCart

  {
    boolean orderCompleted = true;
    // Get the user's session and shopping cart
    HttpSession session = request.getSession(true);
    ResourceBundle messages = (ResourceBundle)session.getAttribute("messages");
    ShoppingCart cart =
      (ShoppingCart)session.getAttribute("cart");
    if (cart == null) {
      cart = new ShoppingCart();
      session.setAttribute("cart", cart);
    }
    // Update the inventory
    try {
      bookDB.buyBooks(cart);
View Full Code Here

Examples of com.emc.plants.service.interfaces.ShoppingCart

  @RequestMapping(method=RequestMethod.GET)
  public String performTask(HttpServletRequest req,
      HttpServletResponse resp){
    logger.debug("InitCheckOutShoppingController:performTask");
    OrderInfo orderinfo = null;
    ShoppingCart shoppingCart=null;
    HttpSession session = req.getSession(true);
    CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
    String customerID = customerInfo.getCustomerID();
    shoppingCart=(ShoppingCart)session.getAttribute(Util.ATTR_CART);
    // Make sure ShopingCart reference has not timed out.
    try
    {
      logger.debug("orderinfodone: ShoppingCart timeout? check getItems() method");
      shoppingCart.getItems();
    }
    // TODO: what exception gets thrown?
    catch (RuntimeException e)
    {
      // ShoppingCart timed out, so create a new one.
      logger.debug("orderinfodone: ShoppingCart ref must have timed out");
      ShoppingCartContents cartContents = (ShoppingCartContents) session.getAttribute(Util.ATTR_CART_CONTENTS);
      if (cartContents != null)
      {
        shoppingCart = (ShoppingCart)Util.getSpringBean("shopping");
        shoppingCart.setCartContents(cartContents);
      }
      else
      {
        logger.error("NoSuchObject Exception!!!");
        logger.error("Major Problem!!!");
        shoppingCart = null;
      }
    }
    logger.debug("orderinfodone: got cart?");
    if (shoppingCart != null)
    {
      logger.debug("orderinfodone: cart not NULL");
      String billName = req.getParameter("bname");
      String billAddr1 = req.getParameter("baddr1");
      String billAddr2 = req.getParameter("baddr2");
      String billCity = req.getParameter("bcity");
      String billState = req.getParameter("bstate");
      String billZip = req.getParameter("bzip");
      String billPhone = req.getParameter("bphone");
      String shipName = req.getParameter("sname");
      String shipAddr1 = req.getParameter("saddr1");
      String shipAddr2 = req.getParameter("saddr2");
      String shipCity = req.getParameter("scity");
      String shipState = req.getParameter("sstate");
      String shipZip = req.getParameter("szip");
      String shipPhone = req.getParameter("sphone");
      int shippingMethod = Integer.parseInt(req.getParameter("shippingMethod"));
      String creditCard = req.getParameter("ccardname");
      String ccNum = req.getParameter("ccardnum");
      String ccExpireMonth = req.getParameter("ccexpiresmonth");
      String ccExpireYear = req.getParameter("ccexpiresyear");
      String cardHolder = req.getParameter("ccholdername");
      orderinfo = shoppingCart.createOrder(customerID, billName, billAddr1, billAddr2, billCity, billState, billZip, billPhone, shipName, shipAddr1, shipAddr2, shipCity, shipState, shipZip, shipPhone, creditCard, ccNum, ccExpireMonth, ccExpireYear, cardHolder, shippingMethod, shoppingCart.getItems());
      logger.debug("orderinfodone: order created");
    }
    if (orderinfo != null)
    {
      req.setAttribute(Util.ATTR_ORDERINFO, orderinfo);
      req.setAttribute(Util.ATTR_CARTITEMS, shoppingCart.getItems());
      session.setAttribute(Util.ATTR_ORDERKEY, orderinfo.getID());
  //    requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_CHECKOUTFINAL);
      return Util.CHECKOUTFINAL;
    }
 
View Full Code Here

Examples of com.google.checkout.ShoppingCart

      HttpServletRequest _request) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Building CheckoutShoppingCart from HTTP Request");
    }
    CheckoutShoppingCart checkoutCart = new CheckoutShoppingCart();
    ShoppingCart cart = new ShoppingCart();
    Items items = new Items();
    // Start with 0
    int lineNum = 0;
    while (_request.getParameter(PARAM_ITEM_NAME + lineNum) != null
        && _request.getParameter(PARAM_ITEM_DESCRIPTION + lineNum) != null
        && _request.getParameter(PARAM_UNIT_PRICE + lineNum) != null
        && _request.getParameter(PARAM_QUANTITY + lineNum) != null) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Found items for line " + lineNum);
      }
      Item item = new Item();
      item.setItemName(_request.getParameter(PARAM_ITEM_NAME + lineNum));
      item.setItemDescription(_request
          .getParameter(PARAM_ITEM_DESCRIPTION + lineNum));
      UnitPrice price = new UnitPrice();
      price.setContent(new BigDecimal(_request
          .getParameter(PARAM_UNIT_PRICE + lineNum)));
      if (_request.getParameter(PARAM_UNIT_PRICE + lineNum + PARAM_DOT_CURRENCY) != null) {
        price.setCurrency(_request.getParameter(PARAM_UNIT_PRICE
            + lineNum + PARAM_DOT_CURRENCY));
      } else {
        price.setCurrency(USD);
      }
      item.setUnitPrice(price);
      item.setQuantity(Integer.parseInt(_request.getParameter(PARAM_QUANTITY
          + lineNum)));
      items.addItem(item);
      lineNum++;
    }
    cart.setItems(items);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Added " + lineNum + " items to the cart.");
    }
    checkoutCart.setShoppingCart(cart);
    CheckoutFlowSupport flowSupport = new CheckoutFlowSupport();
View Full Code Here

Examples of com.google.checkout.schema._2.ShoppingCart

  public void testCreateShoppingCart() throws Exception {
    CheckoutCartBuilder pBuilder = CheckoutCartBuilder.getInstance();
    List<Item> cartItems = makeCartItems();
    int cartSize = cartItems.size();
    Date cartExpiry = new Date(System.currentTimeMillis() + 3600000L);
    ShoppingCart cart = pBuilder.createShoppingCart(cartItems, cartExpiry, null);
   
    assertNotNull(cart);
    assertEquals(cart.getItems().getItem().size(), cartSize);
    assertNull(cart.getMerchantPrivateData());
  }
View Full Code Here

Examples of com.google.checkout.sdk.domain.ShoppingCart

    private OrderProcessingSupport orderProcessingSupport;
    private boolean hasBeenBuilt;

    CheckoutShoppingCartBuilder(CartPoster cartPoster) {
      this.cartPoster = cartPoster;
      this.shoppingCart = new ShoppingCart();
      this.hasBeenBuilt = false;
      shoppingCart.setItems(new Items());
    }
View Full Code Here

Examples of com.jada.order.cart.ShoppingCart

            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
      init(request);
      ContentBean contentBean = getContentBean(request);
      Site site = contentBean.getSiteDomain().getSite();
    ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      EntityManager em = null;
    em = JpaConnection.getInstance().getCurrentEntityManager();
   
    Customer customer = getCustomer(request);
    if (customer.getCustPassword() == null) {
        ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ActionMessages errors = validate(form, site.getSiteId());
      if (errors.size() != 0) {
        saveMessages(request, errors);
        form.setCustPassword(null);
        form.setCustVerifyPassword(null);
        this.initAddressInfo(form, site, shoppingCart, request, errors);
        this.initSearchInfo(form, site.getSiteId(), errors);
        this.initCartInfo(form, site, shoppingCart, request, errors);
            createEmptySecureTemplateInfo(request);
        return actionMapping.findForward("error");
      }
      Customer c = (Customer) em.find(Customer.class, customer.getCustId());
      c.setCustPassword(AESEncoder.getInstance().encode(form.getCustPassword()));
      c.setCustPublicName(form.getCustPublicName());
       }
   
      PayPalEngine paymentEngine = (PayPalEngine) shoppingCart.getPaymentEngine();
      String orderNum = null;
      createEmptySecureTemplateInfo(request);
    OrderEngine orderEngine = new OrderEngine(shoppingCart, null);
      try {
        OrderHeader orderHeader = orderEngine.getOrderHeader();
      InvoiceEngine invoiceEngine = new InvoiceEngine(orderHeader, null);
      invoiceEngine.invoiceAll();
      invoiceEngine.setCreditCardInfo(orderEngine.getCreditCardInfo());
      invoiceEngine.payOrder(shoppingCart.getPaymentEngine(), request);
      orderEngine.saveOrder();
      orderNum = orderEngine.getOrderHeader().getOrderNum();
      invoiceEngine.saveOrder();
      }
      catch (PaymentException e) {
        logger.error(e);
        paymentEngine.cancelPayment();
        shoppingCart.cancelTransaction();
        em.getTransaction().setRollbackOnly();
        return actionMapping.findForward("paymentError");
      }
     
      try {
View Full Code Here

Examples of com.jboss.dvd.seam.ShoppingCart

                invokeAction("#{search.addToCart}");
            }
           
            @Override
            protected void renderResponse() throws Exception {
                ShoppingCart cart = (ShoppingCart) getValue("#{cart}");
                assert cart != null;
                assert cart.getCart().size() == 1;
            }
        }.run();
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void beforeRequest() {
                setParameter("id", "42");
            }         
        }.run();
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void invokeApplication() throws Exception {
                invokeAction("#{search.addToCart}");
            }
           
            @Override
            protected void renderResponse() throws Exception {
                ShoppingCart cart = (ShoppingCart) getValue("#{cart}");
                assert cart != null;
                assert cart.getCart().size() == 2;
            }
        }.run();
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void beforeRequest() {
                setParameter("id", "41");
            }        
        }.run();
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void invokeApplication() throws Exception {
                invokeAction("#{search.addToCart}");
            }
           
            @Override
            protected void renderResponse() throws Exception {
                ShoppingCart cart = (ShoppingCart) getValue("#{cart}");
                assert cart != null;
                assert cart.getCart().size() == 2;
            }
        }.run();
       
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void beforeRequest() {
                setParameter("id", "43");
            }          
        }.run();
       
        new FacesRequest("/dvd.xhtml", id) {
            @Override
            protected void invokeApplication() throws Exception {
                invokeAction("#{search.addToCart}");
            }
           
            @Override
            protected void renderResponse() throws Exception {
                ShoppingCart cart = (ShoppingCart) getValue("#{cart}");
                assert cart != null;
                assert cart.getCart().size() == 3;
            }
        }.run();
       
    }
View Full Code Here

Examples of com.sun.bookstore.cart.ShoppingCart

        String clear = null;
        BookDBAO bookDBAO = (BookDBAO) getServletContext()
                                           .getAttribute("bookDBAO");
        HttpSession session = request.getSession();
        String selectedScreen = request.getServletPath();
        ShoppingCart cart = (ShoppingCart) session.getAttribute("cart");

        if (cart == null) {
            cart = new ShoppingCart();
            session.setAttribute("cart", cart);
        }

        if (selectedScreen.equals("/bookcatalog")) {
            bookId = request.getParameter("Add");

            if (!bookId.equals("")) {
                try {
                    book = bookDBAO.getBook(bookId);

                    if (book.getOnSale()) {
                        double sale = book.getPrice() * .85;
                        Float salePrice = new Float(sale);
                        book.setPrice(salePrice.floatValue());
                    }

                    cart.add(bookId, book);
                } catch (BookNotFoundException ex) {
                    // not possible
                }
            }
        } else if (selectedScreen.equals("/bookshowcart")) {
            bookId = request.getParameter("Remove");

            if (bookId != null) {
                cart.remove(bookId);
            }

            clear = request.getParameter("Clear");

            if ((clear != null) && clear.equals("clear")) {
                cart.clear();
            }
        } else if (selectedScreen.equals("/bookreceipt")) {
            // Update the inventory
            try {
                utx.begin();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.