Interface CommerceAddToCartStrategy
- All Known Implementing Classes:
AbstractCommerceAddToCartStrategy,BundleCommerceAddToCartStrategy,CommerceAddToCartStrictStrategy,DefaultCommerceAddToCartStrategy,ProductConfigAddToCartStrategy,SelectiveCartAddToCartStrategy
public interface CommerceAddToCartStrategy
A strategy interface for adding products to cart cart.
-
Method Summary
Modifier and TypeMethodDescriptionaddToCart(CommerceCartParameter parameter) Adds to the (existing)CartModelthe (existing)ProductModelin the givenUnitModeland with the givenquantity.addToCart(List<CommerceCartParameter> parameterList) Adds a list of items to the cart.
-
Method Details
-
addToCart
CommerceCartModification addToCart(CommerceCartParameter parameter) throws CommerceCartModificationException Adds to the (existing)CartModelthe (existing)ProductModelin the givenUnitModeland with the givenquantity. If in the cart already an entry with the given product and given unit exists the givenquantityis added to the the quantity of this cart entry unlessforceNewEntryis 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- TheProductModelto 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 theproductis a base product OR the quantity is less than 1 or no usable unit was found (only when givenunitis alsonull) or any other reason the cart could not be modified.
-
addToCart
List<CommerceCartModification> addToCart(List<CommerceCartParameter> parameterList) throws CommerceCartMergingException Adds a list of items to the cart.- Parameters:
parameterList- a list ofCommerceCartParameteritems- Returns:
- a list of
CommerceCartModificationitems - Throws:
CommerceCartMergingException
-