productcustomfieldlookup#
The productcustomfieldlookup
property allows Page Builder users to select a value from a predefined list of product custom field values, as configured in the Miva admin under Product Fields. This is useful for displaying badges, conditional layouts, or behaviors based on catalog metadata.
productcustomfieldlookup
Definition#
{
"code": "product_custom_field",
"prompt": "Select a Product Custom Field",
"type": "productcustomfieldlookup",
"required": false,
"preview_property_selector": ".some-selector"
}
Supported Fields#
Field | Type | Required | Description |
---|---|---|---|
type |
string | Yes | Must be "productcustomfieldlookup" |
code |
string | Yes | Unique identifier used in l.settings:instance |
prompt |
string | Yes | Label shown in the Page Builder admin UI |
required |
boolean | No | If true , user must select a value before saving. Defaults to false |
visibility_conditions |
object | No | Used for conditional UI logic |
l.settings:instance
Structure#
The productcustomfieldlookup
property returns a single value, based on the selected option. The value will output in the following format <module_code>:<custom_field_code>
:
:product_tag:value=cmp-mv-prodctgy-meta%3Adescription
"product_custom_field": {
"value": "cmp-mv-prodctgy-meta:description"
}
Template Usage#
<mvt:if expr="'customfields' CIN l.settings:instance:product_custom_field:value">
<mvt:comment>
|
| Extract the custom field code from the l.settings:instance:product_custom_field:value value
|
</mvt:comment>
<mvt:assign name="l.settings:custom_field_code" value="gettoken(l.settings:instance:product_custom_field:value, ':', 2)" />
<mvt:comment>
|
| Read the custom field value from the product custom field code extracted
|
</mvt:comment>
<mvt:item name="customfields" param="Read_Product_Code( l.settings:product:code, l.settings:custom_field_code, l.settings:product:customfield_values:product_custom_field:value )" />
<mvt:comment>
|
| Display the product custom field value
|
</mvt:comment>
&mvt:product:customfield_values:product_custom_field:value;
</mvt:if>
JavaScript Access#
<script>
var instance = <mvt:eval expr="miva_json_encode( l.settings:instance, '' )" />;
var tag = instance.product_custom_field.value;
</script>
defaults
Definition#
You can define a default value inside the defaults
object:
"defaults": {
"product_custom_field": {
"value": "NewArrival"
}
}
Best Practices#
- Use to drive conditional styling, badges, or content blocks.
- Make sure the
code
matches your product custom field code exactly. - Use in combination with
group
,image
, ortexteditor
to visually present product-specific callouts. - Use
visibility_conditions
to toggle the field based on other inputs, if needed.