Examples of ShoppingCartItem


Examples of Java.ShoppingcartItem

                    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))
                        {
                            curSymbol = "$";
                            double conversionRate = new CurrencyConvertor().getCurrencyConvertorSoap().conversionRate(Currency.EUR, Currency.USD);
                            price = (DatabaseKoppeling.getItemPrice(photo, item.getProduct()))*conversionRate;
                        } else {
                            price = DatabaseKoppeling.getItemPrice(photo, item.getProduct());
                        }
                        totalprice += price*amount;
                   
      out.write("\n");
      out.write("                        <tr>\n");
      out.write("                            <td>");
      out.print(photo);
      out.write("</td>\n");
      out.write("                            <td>");
      out.print(item.getProduct());
      out.write("</td>\n");
      out.write("                            <td>");
      out.print(item.getColor());
      out.write("</td>\n");
      out.write("                            <td>");
      out.print(curSymbol + new DecimalFormat("0.00").format(price));
      out.write("</td>\n");
      out.write("                            <td><input name=\"quantity");
View Full Code Here

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

  }

  @Test
  public void testCheckInventory() {

    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
   
    //System.out.println("Shopping :: "+applicationContext);
    shopping.checkInventory(scItem);
    assertTrue(true);
View Full Code Here

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

  }
 
 
  @Test
  public void testCheckInventoryMulti() {
    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
    Collection<ShoppingCartItem> scItemsColln = new ArrayList<ShoppingCartItem>();
    //System.out.println("Shopping :: "+applicationContext);
    scItemsColln.add(scItem);
    shopping.checkInventory(scItemsColln);
View Full Code Here

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

  }
 
  @Test
  @Transactional
  public void testCreateOrder() {
    ShoppingCartItem scItem = new ShoppingCartItem("F0003",
        "Black-eyed Susan", "2 plants", 8.0f, 9.0f, 9, 10);
    Collection<ShoppingCartItem> scItemsColln = new ArrayList<ShoppingCartItem>();
    //System.out.println("Shopping :: "+applicationContext);
    scItemsColln.add(scItem);
   
View Full Code Here

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

        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.emc.plants.pojo.beans.ShoppingCartItem

    //EntityManager em = entityManagerFactory.createEntityManager();
    logger.debug("setCartContents() started execution .. ");
    items = new ArrayList<ShoppingCartItem>();
    int qty;
    String inventoryID;
    ShoppingCartItem si;
    Inventory inv;
    for (int i = 0; i < cartContents.size(); i++)
    {
      inventoryID = cartContents.getInventoryID(i);
      qty = cartContents.getQuantity(inventoryID);
      // Get the Inventory home.
      /*
      InventoryHome inventoryHome = (InventoryHome) Util.getEJBLocalHome("java:comp/env/ejb/Inventory", com.ibm.websphere.samples.pbwjpa.InventoryHome.class);
      try
      { */
      // inv = inventoryHome.findByPrimaryKey(new InventoryKey(inventoryID));
      inv = em.find(Inventory.class, inventoryID);
      // clone so we can use Qty as qty to purchase, not inventory in stock
      si = new ShoppingCartItem(inv);
      si.setQuantity(qty);
      addItem(si);
      /* }
       */
    }
   
 
View Full Code Here

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

   */
  public void addItem(ShoppingCartItem new_item)
  {
    logger.debug("addItem() started execution .. ");
    boolean added = false;
    ShoppingCartItem old_item;
    // If the same item is already in the cart, just increase the quantity.
    for (int i = 0; i < items.size(); i++)
    {
      old_item = (ShoppingCartItem) items.get(i);
      if (new_item.equals(old_item))
      {
        old_item.setQuantity(old_item.getQuantity() + new_item.getQuantity());
        added = true;
        break;
      }
    }
    // Add this item to shopping cart, if it is a brand new item.
View Full Code Here

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

   */
  public void removeItem(ShoppingCartItem item)
  {
    for (Object obj : items)
    {
      ShoppingCartItem si = (ShoppingCartItem) obj;
      if (item.equals(si))
      {
        items.remove(si);
        break;
      }
View Full Code Here

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

   * @return The total cost of all items in the shopping cart.
   */
  public float getTotalCost()
  {
    float total = 0.0f;
    ShoppingCartItem si;
    for (Object o : items)
    {
      si = (ShoppingCartItem) o;
      total += si.getPrice() * si.getQuantity();
    }
    return total;
  }
View Full Code Here

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

   *
   * @param items
   */
  public void checkInventory(Collection <ShoppingCartItem>items)
  {
    ShoppingCartItem si;
    for (Object o : items)
    {
      si = (ShoppingCartItem) o;
      checkInventory(si);     
    }
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.