ProductCustomisation
Extends Object. Represents a group of options available to customise a product. Retrieving customisation options is always done from a product object:
<body>
<div>
<h1>Customise {{ product.title }}</h1>
<?ev for (var group of product.customisations) { ?>
<h2>{{ group.title }}</h2>
<p>{{ group.description }}</p>
<ev:select>
<?ev
for (var option of group.options) {
var el = '<option />'.toDom();
el.attr('value', option.value);
el.text(option.value);
print(el);
}
?>
</ev:select>
<?ev } ?>
</div>
</body>
Note, this is a very simplified view of how to use product customisations.
Properties |
---|
description
String
The description for the customisation group. |
id
Number
The System ID for the customisation group. |
isFromPrice
Boolean
True if the |
price
Price
| null
The price associated with the customisation. |
required
Boolean
True if the user must add or select a value for the customisation group, else false. |
title
String
The title for the customisation group. |
type
String
The type of widget to use for the customisation option. |
Methods |
---|
hasDescription()
Boolean
Determines whether the Customisation group has a description of length. |
hasOptions()
Boolean
Determines whether the Customisation group has one or more options. |
hasPrice()
Boolean
True if the customisation is associated with an additional price. |
isOptional()
Boolean
True if the user is not required to complete the customisation. |
isRequired()
Boolean
True if the user is required to complete the customisation. |
isSelect()
Boolean
Deprecated, please use |
isText()
Boolean
Deprecated, please use |
isType(String value)
Boolean
Returns TRUE, if the value supplied matches the internal type value, or FALSE if it does not match. |
isTypeCheckbox()
Boolean
Returns TRUE, if the customisation contains multi-select options. |
isTypeColor()
Boolean
Returns TRUE, if the customisation is a single color selection option. |
isTypeFile()
Boolean
Returns TRUE, if the customisation represents a file upload. |
isTypeRadio()
Boolean
Returns TRUE, if the customisation contains single-select options. |
isTypeSelect()
Boolean
Returns TRUE, if the customisation contains single-select options using a select-box. |
isTypeSwatch()
Boolean
Returns TRUE, if the customisation contains swatch-based options. |
isTypeTextArea()
Boolean
Returns TRUE, if the customisation is represented by a multi-line text area. |
isTypeTextField()
Boolean
Returns TRUE, if the customisation is represented by a single-line text field. |
isTypeToggle()
Boolean
Returns TRUE, if the customisation is represented by a on/off switch. |
options()
Array
Returns all available options for the customisation. |
prices()
Array
Returns all price options for the customisation. |