Class DefaultBroadleafProductService<P extends Product>
java.lang.Object
com.broadleafcommerce.cartoperation.service.mapping.DefaultBroadleafProductService<P>
- All Implemented Interfaces:
BroadleafProductService<P>
public class DefaultBroadleafProductService<P extends Product>
extends Object
implements BroadleafProductService<P>
- Author:
- Chris Kittrell (ckittrell)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondetermineDependentItemKey
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem dependantCartItem, P product, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the item key for the dependent cart item.determineVariant
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, P product) Attempt to determine the variant by the requested variant ID on theCartItem
.protected boolean
hasVariantDistinguishingOptions
(P product)
-
Constructor Details
-
DefaultBroadleafProductService
public DefaultBroadleafProductService()
-
-
Method Details
-
determineVariant
@Nullable public Variant determineVariant(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull P product) Description copied from interface:BroadleafProductService
Attempt to determine the variant by the requested variant ID on theCartItem
. Otherwise, if any of theProduct's Options
are marked asProductOptionType.VARIANT_DISTINGUISHING
, we need to determine theVariant
for theCartItem
using theCartItem.getAttributeChoices()
.- Specified by:
determineVariant
in interfaceBroadleafProductService<P extends Product>
- Parameters:
cartItem
- The cart item to determine the variant for.product
- TheProduct
containing options and variants.
-
determineDependentItemKey
public String determineDependentItemKey(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem dependantCartItem, @NonNull P product, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Determines the item key for the dependent cart item.- Specified by:
determineDependentItemKey
in interfaceBroadleafProductService<P extends Product>
- Parameters:
product
- The product of the parent cart itemdependantCartItem
- The dependent cart item whose item key is being determined- Returns:
- the item key for the dependent item
-
hasVariantDistinguishingOptions
-