Class ShoppingCartHelper

java.lang.Object
org.apache.ofbiz.order.shoppingcart.ShoppingCartHelper

public class ShoppingCartHelper extends Object
A facade over the ShoppingCart providing catalog and product services to simplify the interaction with the cart directly.
  • Constructor Details

    • ShoppingCartHelper

      public ShoppingCartHelper(Delegator delegator, LocalDispatcher dispatcher, ShoppingCart cart)
      Changes will be made to the cart directly, as opposed to a copy of the cart provided.
      Parameters:
      cart - The cart to manipulate
  • Method Details

    • addToCart

      public Map<String,Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId, String productCategoryId, String itemType, String itemDescription, BigDecimal price, BigDecimal amount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, Timestamp shipBeforeDate, Timestamp shipAfterDate, ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String,? extends Object> context, String parentProductId)
      Event to add an item to the shopping cart.
    • addToCart

      public Map<String,Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId, String productCategoryId, String itemType, String itemDescription, BigDecimal price, BigDecimal amount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String,? extends Object> context, String parentProductId)
      Overriden for reserveAfterDate.
    • addToCart

      public Map<String,Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId, String productCategoryId, String itemType, String itemDescription, BigDecimal price, BigDecimal amount, BigDecimal quantity, Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId, String accommodationSpotId, Timestamp shipBeforeDate, Timestamp shipAfterDate, Timestamp reserveAfterDate, ProductConfigWrapper configWrapper, String itemGroupNumber, Map<String,? extends Object> context, String parentProductId)
      Event to add an item to the shopping cart with accommodation.
    • addToCartFromOrder

      public Map<String,Object> addToCartFromOrder(String catalogId, String orderId, String[] itemIds, boolean addAll, String itemGroupNumber)
      Add to cart from order map.
      Parameters:
      catalogId - the catalog id
      orderId - the order id
      itemIds - the item ids
      addAll - the add all
      itemGroupNumber - the item group number
      Returns:
      the map
    • addToCartBulk

      public Map<String,Object> addToCartBulk(String catalogId, String categoryId, Map<String,? extends Object> context)
      Adds all products in a category according to quantity request parameter for each; if no parameter for a certain product in the category, or if quantity is 0, do not add. If a _ign_${itemGroupNumber} is appended to the name it will be put in that group instead of the default in the request parameter in itemGroupNumber There are 2 options for the syntax: - name="quantity_${productId}" value="${quantity} - name="product_${whatever}" value="${productId}" (note: quantity is always 1)
    • addToCartBulkRequirements

      public Map<String,Object> addToCartBulkRequirements(String catalogId, Map<String,? extends Object> context)
      Adds a set of requirements to the cart.
    • addCategoryDefaults

      public Map<String,Object> addCategoryDefaults(String catalogId, String categoryId, String itemGroupNumber)
      Adds all products in a category according to default quantity on ProductCategoryMember for each; if no default for a certain product in the category, or if quantity is 0, do not add
    • deleteFromCart

      public Map<String,Object> deleteFromCart(Map<String,? extends Object> context)
      Delete an item from the shopping cart.
    • modifyCart

      public Map<String,Object> modifyCart(Security security, GenericValue userLogin, Map<String,? extends Object> context, boolean removeSelected, String[] selectedItems, Locale locale)
      Update the items in the shopping cart.
    • clearCart

      public boolean clearCart()
      Empty the shopping cart.
    • getCartObject

      public ShoppingCart getCartObject()
      Returns the shopping cart this helper is wrapping.
    • getFeatureAppl

      public GenericValue getFeatureAppl(String productId, String optionField, String featureId)
      get feature appl
    • getRemoveFeatureTypeId

      public String getRemoveFeatureTypeId(String optionField)
      get remove feature type id
    • selectAgreement

      public Map<String,Object> selectAgreement(String agreementId)
      Select an agreement
      Parameters:
      agreementId -
    • setCurrency

      public Map<String,Object> setCurrency(String currencyUomId)
      Sets currency.
      Parameters:
      currencyUomId - the currency uom id
      Returns:
      the currency
    • addOrderTerm

      public Map<String,Object> addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays)
      Add order term map.
      Parameters:
      termTypeId - the term type id
      termValue - the term value
      termDays - the term days
      Returns:
      the map
    • addOrderTerm

      public Map<String,Object> addOrderTerm(String termTypeId, BigDecimal termValue, Long termDays, String textValue)
      Add order term map.
      Parameters:
      termTypeId - the term type id
      termValue - the term value
      termDays - the term days
      textValue - the text value
      Returns:
      the map
    • removeOrderTerm

      public Map<String,Object> removeOrderTerm(int index)
      Remove order term map.
      Parameters:
      index - the index
      Returns:
      the map