Represents one row of a product's variant matrix: a specific combination of parameter options (for example a particular size and colour) together with the SKU that matches it, if one has been created yet. Instances are built by CatalogManager's variants method, which enumerates every combination of the product's parameter options and, for each combination, resolves the matching SKU by lazily searching the product's SKUs. Rows with no matching SKU still appear so an administrator can create one; SKUs that exist but match no combination of current parameter options are appended as extra rows. Used by the manage-SKUs admin screen to drive the variant matrix table.


Properties

PropertyReturnsDescription
baseCostBigDecimalThe base cost of the SKU matching this variant's combination of options.
idStringA synthetic identifier for this variant row, built from the product id followed by each selected parameter name and option name. Used by the manage-SKUs admin screen to identify matrix rows in the page; it is not a persisted or unique-across-products identifier.
imageUrlStringThe URL of the matching SKU's own image, built from its image hash.
optionIdsStringComma-separated list of this variant's parameter option ids, in map iteration order, with a trailing comma. Used by the manage-SKUs admin screen to identify which option combination a matrix row represents.
optionsCollection<ParameterOption>The parameter options that make up this variant, for example the "Colour: Red" and "Size: Large" options for a particular row of the variant matrix.
productProductThe product this variant is a row of.
productSkuProductSkuThe SKU that matches this variant's combination of parameter options, resolving and caching it on first call by searching the product's SKUs (or the SKU list supplied to the constructor) for one whose own options match this variant's options exactly. Returns null if no SKU has been created for this combination yet.
selectableImageHashesStringComma-separated list of hashes of the product's images, for use by the admin UI when offering images to pick as this variant's SKU image.
selectableImagesList<ItemImage>The images available to choose from when setting this variant's SKU image, which are simply the parent product's own images.
skuStringThe code of the SKU matching this variant's combination of options.
skuTitleStringThe display title of the SKU matching this variant's combination of options.

Methods

value(String paramName) · getOptions() · getOptionIds() · getProduct() · getProductSku() · getSku() · getSkuTitle() · getBaseCost() · getImageUrl() · getSelectableImages() · getSelectableImageHashes() · getStock(InventoryLocation location) · getId()

value(String paramName)

Returns: String

Looks up the display title of this variant's option for the given parameter name, for example the value "Red" for the parameter "Colour".

ParameterDescription
paramNamethe name of the product parameter to look up, for example "Colour"

getOptions()

Returns: Collection<ParameterOption>

The parameter options that make up this variant, for example the "Colour: Red" and "Size: Large" options for a particular row of the variant matrix.

getOptionIds()

Returns: String

Comma-separated list of this variant's parameter option ids, in map iteration order, with a trailing comma. Used by the manage-SKUs admin screen to identify which option combination a matrix row represents.

getProduct()

Returns: Product

The product this variant is a row of.

getProductSku()

Returns: ProductSku

The SKU that matches this variant's combination of parameter options, resolving and caching it on first call by searching the product's SKUs (or the SKU list supplied to the constructor) for one whose own options match this variant's options exactly. Returns null if no SKU has been created for this combination yet.

getSku()

Returns: String

The code of the SKU matching this variant's combination of options.

getSkuTitle()

Returns: String

The display title of the SKU matching this variant's combination of options.

getBaseCost()

Returns: BigDecimal

The base cost of the SKU matching this variant's combination of options.

getImageUrl()

Returns: String

The URL of the matching SKU's own image, built from its image hash.

getSelectableImages()

Returns: List<ItemImage>

The images available to choose from when setting this variant's SKU image, which are simply the parent product's own images.

getSelectableImageHashes()

Returns: String

Comma-separated list of hashes of the product's images, for use by the admin UI when offering images to pick as this variant's SKU image.

getStock(InventoryLocation location)

Returns: Long

Looks up the stock level of the matching SKU at the given inventory location, caching the result per location for the lifetime of this instance.

ParameterDescription
locationthe inventory location to check stock for

getId()

Returns: String

A synthetic identifier for this variant row, built from the product id followed by each selected parameter name and option name. Used by the manage-SKUs admin screen to identify matrix rows in the page; it is not a persisted or unique-across-products identifier.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.