Interface CommerceAddToCartStrategy
-
- All Known Implementing Classes:
AbstractCommerceAddToCartStrategy
,BundleCommerceAddToCartStrategy
,CommerceAddToCartStrictStrategy
,CommerceConfigAddToCartStrategy
,DefaultAddToCartStrategy
,DefaultCommerceAddToCartStrategy
,ProductConfigAddToCartStrategy
,SelectiveCartAddToCartStrategy
public interface CommerceAddToCartStrategy
A strategy interface for adding products to cart cart.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CommerceCartModification
addToCart(CommerceCartParameter parameter)
Adds to the (existing)CartModel
the (existing)ProductModel
in the givenUnitModel
and with the givenquantity
.java.util.List<CommerceCartModification>
addToCart(java.util.List<CommerceCartParameter> parameterList)
Adds a list of items to the cart.
-
-
-
Method Detail
-
addToCart
CommerceCartModification addToCart(CommerceCartParameter parameter) throws CommerceCartModificationException
Adds to the (existing)CartModel
the (existing)ProductModel
in the givenUnitModel
and with the givenquantity
. If in the cart already an entry with the given product and given unit exists the givenquantity
is added to the the quantity of this cart entry unlessforceNewEntry
is set to true. After this the cart is calculated.- Parameters:
parameter
- - A parameter object containing all attributes needed for add to cartCommerceCartParameter.cart
- The user's cart in sessionCommerceCartParameter.pointOfService
- The store object for pick up in store items (only needs to be passed in if you are adding an item to pick upCommerceCartParameter.product
- TheProductModel
to addCommerceCartParameter.quantity
- The quantity to addCommerceCartParameter.unit
- The UnitModel of the product @seeProductModel.getUnit()
CommerceCartParameter.createNewEntry
- The flag for creating a newCartEntryModel
- Returns:
- the cart modification data that includes a statusCode and the actual quantity added to the cart
- Throws:
CommerceCartModificationException
- if theproduct
is a base product OR the quantity is less than 1 or no usable unit was found (only when givenunit
is alsonull
) or any other reason the cart could not be modified.
-
addToCart
java.util.List<CommerceCartModification> addToCart(java.util.List<CommerceCartParameter> parameterList) throws CommerceCartMergingException
Adds a list of items to the cart.- Parameters:
parameterList
- a list ofCommerceCartParameter
items- Returns:
- a list of
CommerceCartModification
items - Throws:
CommerceCartMergingException
-
-