Represents a variation of a product which can be requested by a purchaser For example, for a shirt product, there might be a variation of size which can be either S, M, L or XL Another example is colour, where options might be Black or White In these examples the ProductParameter would be 'size' and 'colour'. The actual sizes and colours available would be ParameterOption's. This may be related directly to the product, or to a purchase option For example, a delivery parameter might be related to the product because its required for all purchase options. But many options will only be valid for a particular purchase option, such as selecting the team edition for an online storage product might require selecting a number of users Another example is a particular smart phone, which might have a ProductParameter called "Colour", and which has ParameterOption's of Gold, White, Black

Group: Database Entities

Implements: Serializable


Properties

PropertyReturnsDescription
displayTypeStringHow the options should be presented to the purchaser, for example as a select box or as a list of images. Only meaningful for a parameter which has options.
fieldDefStringField definition for a parameter which is entered rather than chosen from a list, in the format understood by ExtraField. Null when the parameter is driven by its options.
idlongThe database identifier of this product parameter.
nameStringPortable, path-safe identifier for this parameter, such as size or colour, used when matching an option supplied with an order. Distinct from the title, which is only a display label. Never null.
parameterOptionsList<ParameterOption>The values a purchaser can choose for this parameter, for example Small, Medium and Large for a size parameter. Empty or null for a parameter which is free entry rather than a fixed list.
productProductThe product this parameter belongs to. Never null for a persisted parameter.
titleStringFree-text display label shown to the purchaser when they choose a value, such as Shirt Size. Carries no uniqueness guarantee, unlike the name. Never null, and up to 255 characters.

Methods

getId() · getProduct() · setProduct(Product product) · getName() · setName(String name) · getTitle() · setTitle(String title) · getParameterOptions() · setParameterOptions(List<ParameterOption> parameterOptions) · getFieldDef() · setFieldDef(String s) · getDisplayType() · setDisplayType(String displayType) · addOption() · findOption(Long productOptionId) · findOption(String variantCode) · findOption(String variantCode, boolean matchOnTitle)

getId()

Returns: long

The database identifier of this product parameter.

getProduct()

Returns: Product

The product this parameter belongs to. Never null for a persisted parameter.

setProduct(Product product)

Returns: void

Sets the product this parameter belongs to.

ParameterDescription
productthe owning product

getName()

Returns: String

Portable, path-safe identifier for this parameter, such as size or colour, used when matching an option supplied with an order. Distinct from the title, which is only a display label. Never null.

setName(String name)

Returns: void

Sets the portable, path-safe identifier for this parameter.

ParameterDescription
namethe parameter's name, which must not be null

getTitle()

Returns: String

Free-text display label shown to the purchaser when they choose a value, such as Shirt Size. Carries no uniqueness guarantee, unlike the name. Never null, and up to 255 characters.

setTitle(String title)

Returns: void

Sets the free-text display label shown to the purchaser.

ParameterDescription
titlethe parameter's display title, which must not be null

getParameterOptions()

Returns: List<ParameterOption>

The values a purchaser can choose for this parameter, for example Small, Medium and Large for a size parameter. Empty or null for a parameter which is free entry rather than a fixed list.

setParameterOptions(List<ParameterOption> parameterOptions)

Returns: void

Sets the values a purchaser can choose for this parameter.

ParameterDescription
parameterOptionsthe available options for this parameter

getFieldDef()

Returns: String

Field definition for a parameter which is entered rather than chosen from a list, in the format understood by ExtraField. Null when the parameter is driven by its options.

setFieldDef(String s)

Returns: void

Sets the field definition used when this parameter is entered rather than chosen from a list.

ParameterDescription
sthe field definition string, in ExtraField format

getDisplayType()

Returns: String

How the options should be presented to the purchaser, for example as a select box or as a list of images. Only meaningful for a parameter which has options.

setDisplayType(String displayType)

Returns: void

Sets how the options should be presented to the purchaser.

ParameterDescription
displayTypethe display type code

addOption()

Returns: ParameterOption

Creates a new, empty option, adds it to this parameter's option list and links it back to this parameter. The option is only held in memory: save it through the session yourself.

findOption(Long productOptionId)

Returns: ParameterOption

Looks up one of this parameter's options by its database identifier. Scans the already-loaded option list rather than querying, so it is cheap once the options are loaded.

ParameterDescription
productOptionIdthe identifier of the option to find, which must not be null

findOption(String variantCode)

Returns: ParameterOption

Looks up one of this parameter's options by name, ignoring case. Titles are not considered; use the two argument form to fall back to matching on title.

ParameterDescription
variantCodethe option name to look for

findOption(String variantCode, boolean matchOnTitle)

Returns: ParameterOption

Looks up one of this parameter's options by name, ignoring case, optionally falling back to matching on the display title when no name matches. Scans the already-loaded option list rather than querying.

ParameterDescription
variantCodethe option name, or title, to look for
matchOnTitletrue to also try matching the option title when no name matches
To get full access to the Kademi Hub existing customers can login here, or new customers can register here.