Class ProductOptionValueCombinationService

java.lang.Object
com.broadleafcommerce.catalog.service.option.ProductOptionValueCombinationService

public class ProductOptionValueCombinationService extends Object
Used to generate combinations from a list of product options and their allowed values. This is primarily used in Sku generation
Author:
Phillip Verheyden (phillipuniverse)
  • Constructor Details

    • ProductOptionValueCombinationService

      public ProductOptionValueCombinationService()
  • Method Details

    • generateValueCombinations

      public List<Set<ProductOptionValueCombination>> generateValueCombinations(List<ProductOption> variantDistinguishingOptions, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)

      Generate all of the unique combinations for a given set of ProductOptionRef. The number of combinations that are generated should equal the number of allowed values of each product option multiplied together.

      ProductOptionRefs that participate in combination detection are only those where ProductOptionRef#isVariantDistinguishing() is true.

      The allowed values for a given ProductOptionRef are read from the underlying data store to generate the combinations

      Parameters:
      variantDistinguishingOptions - seed of options to generate combinations for, should all be of type DefaultProductOptionType.VARIANT_DISTINGUISHING
      context - the sandbox and multi-tenant context to run this operation under
      Returns:
      all of the combinations from the OptionTemplateValues for the given set of options
    • generateValueCombinationsHelper

      protected List<Set<ProductOptionValueCombination>> generateValueCombinationsHelper(int currentOptionIdx, Set<ProductOptionValueCombination> currentCombination, List<ProductOption> options, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • getValues

      protected List<AttributeChoiceValue> getValues(@NonNull @NonNull ProductOption option, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)