Class DefaultCartItemProductService

    • Method Detail

      • populateProductInformation

        public com.broadleafcommerce.cart.client.domain.CartItem populateProductInformation​(com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                                                            Product product,
                                                                                            List<Product> productList,
                                                                                            boolean isAdd)
        Description copied from interface: CartItemProductService
        Populate product information within the CartItem based on the provided product
        Specified by:
        populateProductInformation in interface CartItemProductService
        Parameters:
        cartItem - The CartItem that is to be updated with product data
        product - The product that this CartItem is intended to represent
        productList - The products that were retrieved for the add-to-cart, including dependent item products
        isAdd - Whether we are in an add-to-cart flow
        Returns:
        the updated CartItem that now contains Product data
      • populateProductInformation

        public com.broadleafcommerce.cart.client.domain.CartItem populateProductInformation​(@NonNull
                                                                                            @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                                                            @NonNull
                                                                                            @NonNull Product product,
                                                                                            List<Product> productList,
                                                                                            boolean isAdd,
                                                                                            @Nullable
                                                                                            com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: CartItemProductService
        Populate product information within the CartItem based on the provided product and the merchandising context
        Specified by:
        populateProductInformation in interface CartItemProductService
        Parameters:
        cartItem - The CartItem that is to be updated with product data
        product - The product that this CartItem is intended to represent
        productList - The products that were retrieved for the add-to-cart, including dependent item products
        isAdd - Whether we are in an add-to-cart flow
        contextInfo - Context information around sandbox and multitenant state
        Returns:
        the updated CartItem that now contains Product data
      • getDataDrivenEnumId

        @Nullable
        protected String getDataDrivenEnumId​(@Nullable
                                             DataDrivenEnum dataDrivenEnum)
      • cleanPriceInfo

        protected com.broadleafcommerce.pricing.client.domain.PriceInfo cleanPriceInfo​(@NonNull
                                                                                       @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)
        Exclude PriceableTarget information from the PriceInfo as it's unnecessary to calculate pricing.
        Parameters:
        priceInfo - The price info to clean up for addition to CartItem attributes
        Returns:
        The price info with target information excluded
      • getPricingKey

        protected String getPricingKey​(Product product,
                                       com.broadleafcommerce.cart.client.domain.CartItem cartItem)
        Returns the product price key, if specified, otherwise retrieves it from the cart item or generates a new one. This in general only needed for the DefaultProductType.MERCHANDISING_PRODUCT as it doesn't have the SKU and pricing key.
        Parameters:
        product - the product to get the pricing key from
        cartItem - the cart item to get the pricing key from
        Returns:
        the pricing key
      • getImageAssetForProduct

        @Nullable
        protected com.broadleafcommerce.cart.client.domain.ImageAssetRef getImageAssetForProduct​(@NonNull
                                                                                                 @NonNull Product product)
      • getImageAssetForVariant

        @Nullable
        protected com.broadleafcommerce.cart.client.domain.ImageAssetRef getImageAssetForVariant​(@NonNull
                                                                                                 @NonNull Variant variant,
                                                                                                 @NonNull
                                                                                                 @NonNull Product product)
      • getCategoryIdsForProduct

        protected Set<String> getCategoryIdsForProduct​(@NonNull
                                                       @NonNull Product product)
      • populateVariantInformation

        protected void populateVariantInformation​(@NonNull
                                                  @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                  @NonNull
                                                  @NonNull Variant variant,
                                                  Map<String,​com.broadleafcommerce.pricing.client.domain.PriceInfo> skuPriceInfos)
      • buildItemAttributeChoices

        protected Map<String,​com.broadleafcommerce.order.common.domain.AttributeChoiceValue> buildItemAttributeChoices​(@NonNull
                                                                                                                             @NonNull Map<String,​String> requestItemAttributeChoices)
      • populateAttributeChoiceLabelsFromOptions

        protected void populateAttributeChoiceLabelsFromOptions​(@NonNull
                                                                @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                                @NonNull
                                                                @NonNull Product product)
      • populateDependentItemInformation

        @Deprecated
        protected void populateDependentItemInformation​(@NonNull
                                                        @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                        @NonNull
                                                        @NonNull Product product,
                                                        @NonNull
                                                        @NonNull List<Product> products,
                                                        boolean isAdd)
        Deprecated.
      • populateDependentItemInformation

        protected void populateDependentItemInformation​(@NonNull
                                                        @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem,
                                                        @NonNull
                                                        @NonNull Product product,
                                                        @NonNull
                                                        @NonNull List<Product> products,
                                                        boolean isAdd,
                                                        @Nullable
                                                        com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)