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 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 the CartItem. Otherwise, if any of the Product's Options are marked as ProductOptionType.VARIANT_DISTINGUISHING, we need to determine the Variant for the CartItem using the CartItem.getAttributeChoices().
      Specified by:
      determineVariant in interface BroadleafProductService<P extends Product>
      Parameters:
      cartItem - The cart item to determine the variant for.
      product - The Product 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 interface BroadleafProductService<P extends Product>
      Parameters:
      product - The product of the parent cart item
      dependantCartItem - The dependent cart item whose item key is being determined
      Returns:
      the item key for the dependent item
    • hasVariantDistinguishingOptions

      protected boolean hasVariantDistinguishingOptions(@NonNull P product)