One selectable value of a product parameter, for example Black or White for a "Colour" parameter. Each option belongs to exactly one ProductParameter, which in turn belongs to a product, and the set of options is what a shopper chooses between when configuring that product. An option may carry its own incremental cost and its own image, so the same product can be priced and pictured differently depending on which options are selected.
Group: Database Entities
Implements: Serializable
Properties
| Property | Returns | Description |
|---|---|---|
| cost | BigDecimal | The incremental cost of choosing this option, added to the product's base cost. May be null, which means the option does not affect price and the cost comes from the product alone. The value may be negative to make an option cheaper. Where several options are selected their costs are all added, so an iphone at 500 with colour gold at 100 and size 32Gb at 50 comes to 650. |
| id | long | The database identifier of this parameter option. |
| imageHash | String | Content hash of an image illustrating this option, for example a swatch of the colour. Resolve it through the content repository to render the image. Null when no image has been set. |
| name | String | The identifier for this option within its parameter, such as "green" or a SKU fragment. Use this when matching a selection made by a shopper; the human readable label is the title. Never null for a persisted option. |
| position | Integer | Sort order of this option when the parameter's options are listed for selection, used to keep naturally ordered values such as S, M, L, XL in sequence rather than alphabetical. Null when no explicit ordering has been given. |
| productParameter | ProductParameter | The parameter this option belongs to, such as the "Colour" or "Size" parameter of a product. Never null for a persisted option. |
| title | String | The display label shown to shoppers for this option, such as "Lime Green". This is free text with no uniqueness guarantee, unlike the name. Never null for a persisted option. |
Methods
getId() · getProductParameter() · getName() · setName(String name) · getTitle() · setTitle(String title) · getCost() · setCost(BigDecimal cost) · getImageHash() · setImageHash(String imageHash) · getPosition() · setPosition(Integer position)
getId()
Returns: long
The database identifier of this parameter option.
getProductParameter()
Returns: ProductParameter
The parameter this option belongs to, such as the "Colour" or "Size" parameter of a product. Never null for a persisted option.
getName()
Returns: String
The identifier for this option within its parameter, such as "green" or a SKU fragment. Use this when matching a selection made by a shopper; the human readable label is the title. Never null for a persisted option.
setName(String name)
Returns: void
Sets the identifier for this option within its parameter.
| Parameter | Description |
|---|---|
name | the option's identifying name, such as "green" or a SKU fragment |
getTitle()
Returns: String
The display label shown to shoppers for this option, such as "Lime Green". This is free text with no uniqueness guarantee, unlike the name. Never null for a persisted option.
setTitle(String title)
Returns: void
Sets the display label shown to shoppers for this option.
| Parameter | Description |
|---|---|
title | the option's display label, such as "Lime Green" |
getCost()
Returns: BigDecimal
The incremental cost of choosing this option, added to the product's base cost. May be null, which means the option does not affect price and the cost comes from the product alone. The value may be negative to make an option cheaper. Where several options are selected their costs are all added, so an iphone at 500 with colour gold at 100 and size 32Gb at 50 comes to 650.
setCost(BigDecimal cost)
Returns: void
Sets the incremental cost added to the product's base cost when this option is chosen.
| Parameter | Description |
|---|---|
cost | the incremental cost, which may be negative, or null for no price effect |
getImageHash()
Returns: String
Content hash of an image illustrating this option, for example a swatch of the colour. Resolve it through the content repository to render the image. Null when no image has been set.
setImageHash(String imageHash)
Returns: void
Sets the content hash of the image illustrating this option.
| Parameter | Description |
|---|---|
imageHash | the image content hash, or null to remove the image |
getPosition()
Returns: Integer
Sort order of this option when the parameter's options are listed for selection, used to keep naturally ordered values such as S, M, L, XL in sequence rather than alphabetical. Null when no explicit ordering has been given.
setPosition(Integer position)
Returns: void
Sets the sort order of this option when the parameter's options are listed.
| Parameter | Description |
|---|---|
position | the sort position, or null to leave the options unordered |