Interface ProductOption
- All Superinterfaces:
MultiTenantCloneable<ProductOption>,Serializable
- All Known Implementing Classes:
ProductOptionImpl
A product option represents a value that is entered to specify more information about a product prior to entering into the cart.
For example, a product of type shirt might have product options of "size" and "color".
There is an inherent relationship between product options and product SKUs. A sku is meant to provide a way to override the pricing of a product for a specific set of options. Inventory can also be tracked at the SKU level.
For example, consider a shirt that is sold in 5 colors and 5 sizes. For this example, there would be 1 product. It would have 10 options (5 colors + 5 sizes). The product would have as few as 1 SKu and a many as 26 SKUs.
1 SKU would indicate that the system is not tracking inventory for the items and that all of the variations of shirt are priced the same way.
26 would indicate that there are 25 SKUs that are used to track inventory and potentially override pricing. The extra "1" sku is used to hold the default pricing.
- Author:
- bpolster
-
Method Summary
Modifier and TypeMethodDescriptionGets the available values that a user can select for this ProductOption.Gets the attribute name for where the ProductOptionValue selected for this ProductOption is stored in the OrderItemAttributes for the OrderItemGets the display order of this option in relation to the otherProductOptionsgetId()Returns unique identifier of the product option.getLabel()The label to show to the user when selecting from the availableProductOptionValues.getName()Returns name of the product option.Deprecated, for removal: This API element is subject to removal in a future version.use getProductXrefs insteadgetType()Returns the option type.voidsetAllowedValues(List<ProductOptionValue> allowedValues) Set the allowed values for this ProductOptionvoidsetAttributeName(String name) Sets the attribute name that will be used in storing the selected ProductOptionValue for this ProductOptionvoidsetDisplayOrder(Integer displayOrder) Gets the display order of this option in relation to the otherProductOptionsvoidsetErrorCode(String errorCode) voidsetErrorMessage(String errorMessage) voidSets the unique identifier of the product option.voidSets the label to show the user when selecting from the availableProductOptionValuesvoidsetLongDescription(String longDescription) voidSets the name of the product option.voidsetProductOptionValidationStrategyType(ProductOptionValidationStrategyType productOptionValidationType) voidsetProductOptionValidationType(ProductOptionValidationType productOptionValidationType) voidsetProducts(List<Product> products) Deprecated, for removal: This API element is subject to removal in a future version.use setProductXrefs insteadvoidsetProductXrefs(List<ProductOptionXref> xrefs) voidsetRequired(Boolean required) Sets whether or notvoidsetType(ProductOptionType type) Sets the option type.voidsetUseInSkuGeneration(Boolean useInSkuGeneration) voidsetValidationString(String validationString) Methods inherited from interface org.broadleafcommerce.common.copy.MultiTenantCloneable
createOrRetrieveCopyInstance
-
Method Details
-
getId
Long getId()Returns unique identifier of the product option.- Returns:
-
setId
Sets the unique identifier of the product option.- Parameters:
id-
-
getName
String getName()Returns name of the product option.- Returns:
-
setName
Sets the name of the product option.- Parameters:
name-
-
getType
ProductOptionType getType()Returns the option type. For example, "color", "size", etc. These are used primarily to determine how the UI should prompt for and validate the product option.- Returns:
-
setType
Sets the option type. This is primarily used for display to render the option selection.- Parameters:
type-
-
getAttributeName
String getAttributeName()Gets the attribute name for where the ProductOptionValue selected for this ProductOption is stored in the OrderItemAttributes for the OrderItem- Returns:
- the name of the OrderItemAttribute to store the selected ProductOptionValue in the Order domain
-
setAttributeName
Sets the attribute name that will be used in storing the selected ProductOptionValue for this ProductOption- Parameters:
name- - the name of the OrderItemAttribute to store the selected ProductOptionValue in the Order domain
-
getLabel
String getLabel()The label to show to the user when selecting from the availableProductOptionValues. This might be "Color" or "Size"- Returns:
-
setLabel
Sets the label to show the user when selecting from the availableProductOptionValues- Parameters:
label-
-
getRequired
Boolean getRequired()- Returns:
- whether or not this ProductOption is required
-
setRequired
Sets whether or not- Parameters:
required-
-
getDisplayOrder
Integer getDisplayOrder()Gets the display order of this option in relation to the otherProductOptions- Returns:
-
setDisplayOrder
Gets the display order of this option in relation to the otherProductOptions- Parameters:
displayOrder-
-
getProducts
Deprecated, for removal: This API element is subject to removal in a future version.use getProductXrefs insteadGets all the Products associated with this ProductOption- Returns:
- the Products associated with this ProductOption
-
setProducts
Deprecated, for removal: This API element is subject to removal in a future version.use setProductXrefs insteadSet the Products to associate with this ProductOption- Parameters:
products-
-
getProductXrefs
List<ProductOptionXref> getProductXrefs() -
setProductXrefs
-
getAllowedValues
List<ProductOptionValue> getAllowedValues()Gets the available values that a user can select for this ProductOption. This value will be stored in OrderItemAttributes at the OrderItem level. The OrderItemAttribute name will be whatever was returned fromgetAttributeName()- Returns:
- the allowed values for this ProductOption
-
setAllowedValues
Set the allowed values for this ProductOption- Parameters:
allowedValues-
-
getUseInSkuGeneration
Boolean getUseInSkuGeneration() -
setUseInSkuGeneration
-
getProductOptionValidationType
ProductOptionValidationType getProductOptionValidationType() -
setProductOptionValidationType
-
getErrorMessage
String getErrorMessage() -
setErrorMessage
-
getValidationString
String getValidationString() -
setValidationString
-
getErrorCode
String getErrorCode() -
setErrorCode
-
getProductOptionValidationStrategyType
ProductOptionValidationStrategyType getProductOptionValidationStrategyType() -
setProductOptionValidationStrategyType
void setProductOptionValidationStrategyType(ProductOptionValidationStrategyType productOptionValidationType) -
getLongDescription
String getLongDescription() -
setLongDescription
-