Interface CartItemConfigurationService
-
- All Known Implementing Classes:
DefaultCartItemConfigurationService
public interface CartItemConfigurationService- Author:
- Chad Harchar (charchar)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description VariantdetermineVariant(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Product product)Attempt to determine the variant by the requested variant ID on theCartItem.voidhydrateIncludedProductDependentItems(com.broadleafcommerce.cart.client.domain.CartItem cartItem, List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, Product product, boolean isAdd)PopulateIncludedProductinformation onCartItem.getDependentCartItems()based on the product configuration.voidhydrateItemChoiceDependentItems(com.broadleafcommerce.cart.client.domain.CartItem cartItem, List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, Product product)PopulateItemChoiceinformation onCartItem.getDependentCartItems()based on the product configuration.voidvalidateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, Product product, String validationFlow)Process cart item configuration by validating product options.
-
-
-
Method Detail
-
determineVariant
@Nullable Variant determineVariant(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Product product)
Attempt to determine the variant by the requested variant ID on theCartItem. Otherwise, if any of theProduct's Optionsare marked asProductOptionType.VARIANT_DISTINGUISHING, we need to determine theVariantfor theCartItemusing theCartItem.getAttributeChoices().- Parameters:
cartItem- The cart item to determine the variant for.product- TheProductcontaining options and variants.
-
hydrateIncludedProductDependentItems
void hydrateIncludedProductDependentItems(com.broadleafcommerce.cart.client.domain.CartItem cartItem, List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, Product product, boolean isAdd)PopulateIncludedProductinformation onCartItem.getDependentCartItems()based on the product configuration.- Parameters:
cartItem- The cart item on which to populate dependent item product configuration information.potentialDependentItems- The list ofCartItem.getDependentCartItems()to pick from to find a match for anIncludedProduct.product- The product with configuration to be used for hydration.isAdd- Whether we are in an add-to-cart flow
-
hydrateItemChoiceDependentItems
void hydrateItemChoiceDependentItems(com.broadleafcommerce.cart.client.domain.CartItem cartItem, List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, Product product)PopulateItemChoiceinformation onCartItem.getDependentCartItems()based on the product configuration.- Parameters:
cartItem- The cart item on which to populate dependent item product configuration information.potentialDependentItems- The list ofCartItem.getDependentCartItems()to pick from to find a match for anItemChoice.product- The product with configuration to be used for hydration.
-
validateCartItem
void validateCartItem(com.broadleafcommerce.cart.client.domain.Cart cart, com.broadleafcommerce.cart.client.domain.CartItem cartItem, Product product, String validationFlow)Process cart item configuration by validating product options. Errors for the item will be recorded intoCartItem.getGlobalConfigErrors(), while errors for specific attributes will be recorded intoCartItem.getAttributeConfigErrors(). For hierarchical cart items (items withCartItem.getDependentCartItems()) it is intended that this method be called from the bottom up, i.e., the lowest level dependent item gets called first. That way, errors on items will be properly cascaded up the hierarchy asCartItemConfigurationErrorEnum.MISCONFIGURED_DEPENDENT_ITEMSonCartItem.getGlobalConfigErrors().- Parameters:
cart- The cart with the cart itemcartItem- The cart item with which to process configuration.validationFlow- The context used to identify validation requirements of theCartItemat that point in its lifecycle. If this is set toValidationStrategy.ADD_ITEM, then the configuration service will try to
-
-