Examples of ShoppingCartItem


Examples of com.emc.plants.pojo.beans.ShoppingCartItem

     ccNum, ccExpireMonth, ccExpireYear, cardHolder, shippingMethod, items);
     */
    Collection<OrderItem> orderitems = new ArrayList<OrderItem>();
    //EntityManager em = entityManagerFactory.createEntityManager();
    for (Object o : items) {
      ShoppingCartItem si = (ShoppingCartItem) o;
      Inventory inv = em.find(Inventory.class, si.getID());
      OrderItem oi = new OrderItem(inv);
      oi.setQuantity(si.getQuantity());
      orderitems.add(oi);
    }
    Customer c = em.find(Customer.class, customerID);
    order = new Order(c, billName, billAddr1, billAddr2, billCity, billState, billZip, billPhone,
        shipName, shipAddr1, shipAddr2, shipCity, shipState, shipZip, shipPhone, creditCard,
View Full Code Here

Examples of com.emc.plants.pojo.beans.ShoppingCartItem

    {
      String invID = req.getParameter("itemID");

      // Gets detached instance
      Inventory inv = catalog.getItemInventory(invID);
      ShoppingCartItem si = new ShoppingCartItem(inv);
      si.setQuantity(Integer.parseInt(req.getParameter("qty").trim()));
      shoppingCart.addItem(si);
      session.setAttribute(Util.ATTR_CART, shoppingCart);
      session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
    }
    return PAGE_CART;
View Full Code Here

Examples of com.emc.plants.pojo.beans.ShoppingCartItem

      {
        String invID = req.getParameter("itemID");

        // Gets detached instance
        Inventory inv = catalog.getItemInventory(invID);
        ShoppingCartItem si = new ShoppingCartItem(inv);
        si.setQuantity(Integer.parseInt(req.getParameter("qty").trim()));
        shoppingCart.addItem(si);
        session.setAttribute(Util.ATTR_CART, shoppingCart);
        session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
      }
      requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_CART);
    }
    else if (action.equals(ACTION_UPDATEQUANTITY))
    {
      // Get shopping cart.
      HttpSession session = req.getSession(true);
      ShoppingCart shoppingCart = (ShoppingCart) session.getAttribute(Util.ATTR_CART);
      // Make sure ShopingCart reference has not timed out.
      try
      {
        shoppingCart.getItems();
      }
      // TODO: what exception gets thrown?
      catch (RuntimeException e)
      {
        // ShoppingCart timed out, so create a new one.
        Util.debug("updatequantity: shopping cart ref must have timed out, create a new one");
        ShoppingCartContents cartContents = (ShoppingCartContents) session.getAttribute(Util.ATTR_CART_CONTENTS);
        shoppingCart = (ShoppingCart) WebUtil.getSpringBean(this.getServletContext(), "shopping");
       
       
        if (cartContents != null) {
          shoppingCart.setCartContents(cartContents);
        }
      }
      // Update item quantity in cart.
      if (shoppingCart != null)
      {
        try
        {
          int cnt = 0;
          Collection c = shoppingCart.getItems();
          ArrayList items;

          if (c instanceof ArrayList)
            items = (ArrayList) c;
          else
            items = new ArrayList(c);
          ShoppingCartItem si;
          String parm, parmval;
          // Check all quantity values from cart form.
          for (int parmcnt = 0;; parmcnt++)
          {
            parm = "itemqty" + String.valueOf(parmcnt);
            parmval = req.getParameter(parm);
            // No more quantity fields, so break out.
            if ((parmval == null) || parmval.equals("null"))
            {
              break;
            }
            else // Check quantity value of cart item.
            {
              int quantity = Integer.parseInt(parmval);
              // Quantity set to 0, so remove from cart.
              if (quantity == 0)
              {
                items.remove(cnt);
              }
              else // Change quantity of cart item.
              {
                si = (ShoppingCartItem) items.get(cnt);
                si.setQuantity(quantity);
                items.set(cnt, si);
                cnt++;
              }
            }
          }
          // Are items in cart? Yes, set the session attributes.
          if (items.size() > 0)
          {
            shoppingCart.setItems(items);
            session.setAttribute(Util.ATTR_CART, shoppingCart);
            session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
          }
          else // No items in cart, so remove attributes from session.
          {
            session.removeAttribute(Util.ATTR_CART);
            session.removeAttribute(Util.ATTR_CART_CONTENTS);
          }
        }
        catch (Exception e)
        {
          //  Log the exception but try to continue.
          Util.debug("ShoppingServlet.performAction() -> Exception caught: " +e);
          // This should take us to the error page.
          throw new ServletException(e.getMessage());
        }
      }
      requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_CART);
    }
    else if (action.equals(ACTION_INITCHECKOUT))
    {
      String url;
      HttpSession session = req.getSession(true);
      CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
      if (customerInfo == null)
      {
        req.setAttribute(Util.ATTR_RESULTS, "You must login or register before checking out.");
        session.setAttribute(Util.ATTR_CHECKOUT, new Boolean(true));
        url = Util.PAGE_LOGIN;
      }
      else
      {
        url = Util.PAGE_ORDERINFO;
      }
      requestDispatch(getServletConfig().getServletContext(), req, resp, url);
    }
    else if (action.equals(ACTION_ORDERINFODONE))
    {
      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
      {
        Util.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.
        Util.debug("orderinfodone: ShoppingCart ref must have timed out");
        ShoppingCartContents cartContents = (ShoppingCartContents) session.getAttribute(Util.ATTR_CART_CONTENTS);
        if (cartContents != null)
        {
          shoppingCart = (ShoppingCart) WebUtil.getSpringBean(this.getServletContext(), "shopping");
          shoppingCart.setCartContents(cartContents);
        }
        else
        {
          Util.debug("NoSuchObject Exception!!!");
          Util.debug("Major Problem!!!");
          shoppingCart = null;
        }
      }
      Util.debug("orderinfodone: got cart?");
      if (shoppingCart != null)
      {
        Util.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());
        Util.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);
      }
    }
    else if (action.equals(ACTION_COMPLETECHECKOUT))
    {
      ShoppingCart shoppingCart = null;
      HttpSession session = req.getSession(true);
      long key = (Long) session.getAttribute(Util.ATTR_ORDERKEY);
      req.setAttribute(Util.ATTR_ORDERID, key);
      long orderKey = key;
      Util.debug("completecheckout: order id ="+orderKey );
      CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
      // Check the available inventory and backorder if necessary.
      shoppingCart = (ShoppingCart) session.getAttribute(Util.ATTR_CART);
      // Make sure ShopingCart reference has not timed out.
      try
      {
        Util.debug("completecheckout: ShoppingCart timeout? check getItems() method");
        shoppingCart.getItems();
      }
      // TODO: what exception gets thrown?
      catch (RuntimeException e)
      {
        // ShoppingCart timed out, so create a new one.
        Util.debug("completecheckout: ShoppingCart ref must have timed out");
        ShoppingCartContents cartContents = (ShoppingCartContents) session.getAttribute(Util.ATTR_CART_CONTENTS);
        if (cartContents != null)
        {
          shoppingCart = (ShoppingCart) WebUtil.getSpringBean(this.getServletContext(), "shopping");
          shoppingCart.setCartContents(cartContents);
        }
        else
        {
          Util.debug("NoSuchObject Exception!!!");
          Util.debug("Major Problem!!!");
          shoppingCart = null;
        }
      }
      if (shoppingCart != null)
      {
        ShoppingCartItem si;
        Collection items = shoppingCart.getItems();
        for (Object o : items)
        {
          si = (ShoppingCartItem) o;
          shoppingCart.checkInventory(si);
          Util.debug("ShoppingCart.checkInventory() - checking Inventory quantity of item: " + si.getID());
        }
      }

     
      try
View Full Code Here

Examples of com.emc.plants.pojo.beans.ShoppingCartItem

      {
        String invID = req.getParameter("itemID");

        // Gets detached instance
        Inventory inv = catalog.getItemInventory(invID);
        ShoppingCartItem si = new ShoppingCartItem(inv);
        si.setQuantity(Integer.parseInt(req.getParameter("qty").trim()));
        shoppingCart.addItem(si);
        session.setAttribute(Util.ATTR_CART, shoppingCart);
        session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
      }
      //requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_CART);
      view = Util.CART;
    }
    else if (action.equalsIgnoreCase(ACTION_UPDATEQUANTITY))
    {
      // Get shopping cart.
      HttpSession session = req.getSession(true);
      ShoppingCart shoppingCart = (ShoppingCart) session.getAttribute(Util.ATTR_CART);
      // Make sure ShopingCart reference has not timed out.
      try
      {
        shoppingCart.getItems();
      }
      // TODO: what exception gets thrown?
      catch (RuntimeException e)
      {
        // ShoppingCart timed out, so create a new one.
        logger.debug("updatequantity: shopping cart ref must have timed out, create a new one");
        ShoppingCartContents cartContents = (ShoppingCartContents) session.getAttribute(Util.ATTR_CART_CONTENTS);
        shoppingCart = (ShoppingCart) WebUtil.getSpringBean(session.getServletContext(), "shopping");
       
        if (cartContents != null) {
          shoppingCart.setCartContents(cartContents);
        }
      }
      // Update item quantity in cart.
      if (shoppingCart != null)
      {
        try
        {
          int cnt = 0;
          Collection c = shoppingCart.getItems();
          ArrayList items;

          if (c instanceof ArrayList)
            items = (ArrayList) c;
          else
            items = new ArrayList(c);
          ShoppingCartItem si;
          String parm, parmval;
          // Check all quantity values from cart form.
          for (int parmcnt = 0;; parmcnt++)
          {
            parm = "itemqty" + String.valueOf(parmcnt);
            parmval = req.getParameter(parm);
            // No more quantity fields, so break out.
            if ((parmval == null) || parmval.equals("null"))
            {
              break;
            }
            else // Check quantity value of cart item.
            {
              int quantity = Integer.parseInt(parmval);
              // Quantity set to 0, so remove from cart.
              if (quantity == 0)
              {
                items.remove(cnt);
              }
              else // Change quantity of cart item.
              {
                si = (ShoppingCartItem) items.get(cnt);
                si.setQuantity(quantity);
                items.set(cnt, si);
                cnt++;
              }
            }
          }
          // Are items in cart? Yes, set the session attributes.
          if (items.size() > 0)
          {
            shoppingCart.setItems(items);
            session.setAttribute(Util.ATTR_CART, shoppingCart);
            session.setAttribute(Util.ATTR_CART_CONTENTS, shoppingCart.getCartContents());
          }
          else // No items in cart, so remove attributes from session.
          {
            session.removeAttribute(Util.ATTR_CART);
            session.removeAttribute(Util.ATTR_CART_CONTENTS);
          }
        }
        catch (Exception e)
        {
          //  Log the exception but try to continue.
          logger.debug("ShoppingServlet.performAction() -> Exception caught: " +e);
          // This should take us to the error page.
//          throw new ServletException(e.getMessage());
        }
      }
      //requestDispatch(getServletConfig().getServletContext(), req, resp, Util.PAGE_CART);
      view=Util.CART;
    }
    else if (action.equalsIgnoreCase(ACTION_INITCHECKOUT))
    {
      logger.debug("ShoppingController:performTask:initCheckout");
      String url;
      HttpSession session = req.getSession(true);
      CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
      if (customerInfo == null)
      {
        req.setAttribute(Util.ATTR_RESULTS, "You must login or register before checking out.");
        session.setAttribute(Util.ATTR_CHECKOUT, new Boolean(true));
        url = LOGIN;
      }
      else
      {
        url = ORDERINFO;
      }
      //requestDispatch(getServletConfig().getServletContext(), req, resp, url);
      view=url;
    }
    else if (action.equalsIgnoreCase(ACTION_ORDERINFODONE)) {
      logger.debug("ShoppingController:performTask:orderinfodone");
      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();
      }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)WebUtil.getSpringBean(session.getServletContext(), "shopping");
          shoppingCart.setCartContents(cartContents);
        }
        else
        {
          logger.debug("NoSuchObject Exception!!!");
          logger.debug("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);
        view=CHECKOUTFINAL;
      }
    }
    else if (action.equalsIgnoreCase(ACTION_COMPLETECHECKOUT))
    {
      ShoppingCart shoppingCart = null;
      HttpSession session = req.getSession(true);
      long key = (Long) session.getAttribute(Util.ATTR_ORDERKEY);
      req.setAttribute(Util.ATTR_ORDERID, key);
      long orderKey = key;
      logger.debug("completecheckout: order id ="+orderKey );
      CustomerInfo customerInfo = (CustomerInfo) session.getAttribute(Util.ATTR_CUSTOMER);
      // Check the available inventory and backorder if necessary.
      shoppingCart = (ShoppingCart) session.getAttribute(Util.ATTR_CART);
     
      // Make sure ShopingCart reference has not timed out.
      try {
        logger.debug("completecheckout: ShoppingCart timeout? check getItems() method");
        shoppingCart.getItems();
      } catch (RuntimeException e) {
        // ShoppingCart timed out, so create a new one.
        logger.debug("completecheckout: ShoppingCart ref must have timed out");
        ShoppingCartContents cartContents = (ShoppingCartContents) session
            .getAttribute(Util.ATTR_CART_CONTENTS);
        if (cartContents != null) {
          shoppingCart = (ShoppingCart) WebUtil.getSpringBean(
              session.getServletContext(), "shopping");
          shoppingCart.setCartContents(cartContents);
        } else {
          logger.debug("NoSuchObject Exception!!!");
          logger.debug("Major Problem!!!");
          shoppingCart = null;
        }
      }
     
      if (shoppingCart != null) {
        ShoppingCartItem si;
        Collection items = shoppingCart.getItems();
        for (Object o : items) {
          si = (ShoppingCartItem) o;
          shoppingCart.checkInventory(si);
          logger.debug("ShoppingCart.checkInventory() - checking Inventory quantity of item: "
              + si.getID());
        }
      }

     
      try {
View Full Code Here

Examples of com.jada.order.cart.ShoppingCartItem

    double priceTotal = 0;
    if (shoppingCart != null) {
      Vector<?> vector = shoppingCart.getShoppingCartItems();
      Iterator<?> iterator = vector.iterator();
      while (iterator.hasNext()) {
        ShoppingCartItem shoppingCartItem = (ShoppingCartItem) iterator.next();
        ItemInfo itemInfo = formatItem(shoppingCartItem.getItem());
        itemInfo.setItemOrderedQty(Format.getInt(shoppingCartItem.getItemQty()));
        itemVector.add(itemInfo);
      }
      itemCount = shoppingCart.getItemCount();
      priceTotal = shoppingCart.getPriceTotal();
    }
View Full Code Here

Examples of com.sun.bookstore.cart.ShoppingCartItem

    /**
     * <p>Return the <code>ShoppingCartItem</code> instance from the
     * user request.</p>
     */
    protected ShoppingCartItem item() {
        ShoppingCartItem item = (ShoppingCartItem) context()
                                                       .getExternalContext()
                                                       .getRequestMap()
                                                       .get("item");

        return (item);
View Full Code Here

Examples of org.ofbiz.order.shoppingcart.ShoppingCartItem

        HashMap<String, Object> attrs = new HashMap<String, Object>();
        attrs.put("shipGroup", groupIdx);

        int idx = cart.addItemToEnd(productId, null, qty, null, null, attrs, null, null, dispatcher, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, Boolean.TRUE);
        ShoppingCartItem cartItem = cart.findCartItem(idx);
        cartItem.setQuantity(qty, dispatcher, cart, true, false);
        // locate the price verify it matches the expected price
        BigDecimal cartPrice = cartItem.getBasePrice();
        cartPrice = cartPrice.setScale(ShoppingCart.scale, ShoppingCart.rounding);
        if (price.doubleValue() != cartPrice.doubleValue()) {
            // does not match; honor the price but hold the order for manual review
            cartItem.setIsModifiedPrice(true);
            cartItem.setBasePrice(price);
            cart.setHoldOrder(true);
            cart.addInternalOrderNote("Price received [" + price + "] (for item # " + productId + ") from eBay Checkout does not match the price in the database [" + cartPrice + "]. Order is held for manual review.");
        }
        // assign the item to its ship group
        cart.setItemShipGroupQty(cartItem, qty, groupIdx);
View Full Code Here

Examples of org.ofbiz.order.shoppingcart.ShoppingCartItem

    protected static BigDecimal getCartItemsUsedTotalAmount(ShoppingCart cart, GenericValue productPromoAction) {
        BigDecimal totalAmount = BigDecimal.ZERO;
        Iterator<ShoppingCartItem> cartItemsIter = cart.iterator();
        while (cartItemsIter.hasNext()) {
            ShoppingCartItem cartItem = cartItemsIter.next();
            BigDecimal quantityUsed = cartItem.getPromoQuantityCandidateUseActionAndAllConds(productPromoAction);
            if (quantityUsed.compareTo(BigDecimal.ZERO) > 0) {
                totalAmount = totalAmount.add(quantityUsed.multiply(cartItem.getBasePrice()));
            }
        }
        return totalAmount;
    }
View Full Code Here

Examples of org.ofbiz.order.shoppingcart.ShoppingCartItem

    protected static void distributeDiscountAmount(BigDecimal discountAmountTotal, BigDecimal totalAmount, List<ShoppingCartItem> cartItemsUsed, GenericValue productPromoAction, Delegator delegator) {
        BigDecimal discountAmount = discountAmountTotal;
        // distribute the discount evenly weighted according to price over the order items that the individual quantities came from; avoids a number of issues with tax/shipping calc, inclusion in the sub-total for other promotions, etc
        Iterator<ShoppingCartItem> cartItemsUsedIter = cartItemsUsed.iterator();
        while (cartItemsUsedIter.hasNext()) {
            ShoppingCartItem cartItem = cartItemsUsedIter.next();
            // to minimize rounding issues use the remaining total for the last one, otherwise use a calculated value
            if (cartItemsUsedIter.hasNext()) {
                BigDecimal quantityUsed = cartItem.getPromoQuantityCandidateUseActionAndAllConds(productPromoAction);
                BigDecimal ratioOfTotal = quantityUsed.multiply(cartItem.getBasePrice()).divide(totalAmount, generalRounding);
                BigDecimal weightedAmount = ratioOfTotal.multiply(discountAmountTotal);
                // round the weightedAmount to 3 decimal places, we don't want an exact number cents/whatever because this will be added up as part of a subtotal which will be rounded to 2 decimal places
                weightedAmount = weightedAmount.setScale(3, BigDecimal.ROUND_HALF_UP);
                discountAmount = discountAmount.subtract(weightedAmount);
                doOrderItemPromoAction(productPromoAction, cartItem, weightedAmount, "amount", delegator);
View Full Code Here

Examples of org.ofbiz.order.shoppingcart.ShoppingCartItem

    protected static Integer findPromoItem(GenericValue productPromoAction, ShoppingCart cart) {
        List<ShoppingCartItem> cartItems = cart.items();

        for (int i = 0; i < cartItems.size(); i++) {
            ShoppingCartItem checkItem = cartItems.get(i);

            if (checkItem.getIsPromo()) {
                // found a promo item, see if it has a matching adjustment on it
                Iterator<GenericValue> checkOrderAdjustments = UtilMisc.toIterator(checkItem.getAdjustments());
                while (checkOrderAdjustments != null && checkOrderAdjustments.hasNext()) {
                    GenericValue checkOrderAdjustment = checkOrderAdjustments.next();
                    if (productPromoAction.getString("productPromoId").equals(checkOrderAdjustment.get("productPromoId")) &&
                        productPromoAction.getString("productPromoRuleId").equals(checkOrderAdjustment.get("productPromoRuleId")) &&
                        productPromoAction.getString("productPromoActionSeqId").equals(checkOrderAdjustment.get("productPromoActionSeqId"))) {
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.