Class ShoppingCartHelper
java.lang.Object
org.apache.ofbiz.order.shoppingcart.ShoppingCartHelper
A facade over the
ShoppingCart
providing catalog and product services to simplify the interaction
with the cart directly.-
Constructor Summary
ConstructorDescriptionShoppingCartHelper
(Delegator delegator, LocalDispatcher dispatcher, ShoppingCart cart) Changes will be made to the cart directly, as opposed to a copy of the cart provided. -
Method Summary
Modifier and TypeMethodDescriptionaddCategoryDefaults
(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 addaddOrderTerm
(String termTypeId, BigDecimal termValue, Long termDays) Add order term map.addOrderTerm
(String termTypeId, BigDecimal termValue, Long termDays, String textValue) Add order term map.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.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
(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.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.addToCartBulkRequirements
(String catalogId, Map<String, ? extends Object> context) Adds a set of requirements to the cart.addToCartFromOrder
(String catalogId, String orderId, String[] itemIds, boolean addAll, String itemGroupNumber) Add to cart from order map.boolean
Empty the shopping cart.deleteFromCart
(Map<String, ? extends Object> context) Delete an item from the shopping cart.Returns the shopping cart this helper is wrapping.getFeatureAppl
(String productId, String optionField, String featureId) get feature applgetRemoveFeatureTypeId
(String optionField) get remove feature type idmodifyCart
(Security security, GenericValue userLogin, Map<String, ? extends Object> context, boolean removeSelected, String[] selectedItems, Locale locale) Update the items in the shopping cart.removeOrderTerm
(int index) Remove order term map.selectAgreement
(String agreementId) Select an agreementsetCurrency
(String currencyUomId) Sets currency.
-
Constructor Details
-
ShoppingCartHelper
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 idorderId
- the order iditemIds
- the item idsaddAll
- the add allitemGroupNumber
- 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
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
Returns the shopping cart this helper is wrapping. -
getFeatureAppl
get feature appl -
getRemoveFeatureTypeId
get remove feature type id -
selectAgreement
Select an agreement- Parameters:
agreementId
-
-
setCurrency
Sets currency.- Parameters:
currencyUomId
- the currency uom id- Returns:
- the currency
-
addOrderTerm
Add order term map.- Parameters:
termTypeId
- the term type idtermValue
- the term valuetermDays
- 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 idtermValue
- the term valuetermDays
- the term daystextValue
- the text value- Returns:
- the map
-
removeOrderTerm
Remove order term map.- Parameters:
index
- the index- Returns:
- the map
-