Skip to content

ProductAttribute

The ProductAttribute object represents a single attribute value of a product in the given attribute group.

classDiagram
  direction LR
  ProductAttribute --> Product
  ProductAttribute --> ProductAttributeGroup
  class Product{
  }
  class ProductAttributeGroup{
  }
  class ProductAttribute{
    int id
    string name
    string description
    bool isCheckbox
    bool hasMultipleValues
    string value
    string[] values
    ProductAttributeGroup group
    Product product
  }

Properties

Attribute name Type Description
id int The unique identifier of the product's attribute.
name string The name of the attribute.
description string The description of the attribute.
isCheckbox bool Returns true if attribute is checkbox like tickable parameter.
hasMultipleValues bool Returns true if attribute supports selecting multiple values.
value string The value of the attribute. If attribute is based on checkbox logic, the returned value is stringified 1 or 0. If attribute has multiple values, the returned value is stringified list of joined values with comma.
values string[] The array of values of the attribute. If attribute is based on checkbox logic, the returned value is one element array of stringified 1 or 0. If attribute has multiple values, the returned value is an array of stringified values. If attribute has single value, the returned value is one element array of stringified value.
group ProductAttributesGroup The ProductAttributesGroup object associated with this attribute.
product Product The Product object associated with this attribute.

Examples

id property

{{ productAttribute.id }}
1

name property

{{ productAttribute.name }}
example name

description property

{{ productAttribute.description }}
example description

isCheckbox property

{{ productAttribute.isCheckbox }}
true

hasMultipleValues property

{{ productAttribute.hasMultipleValues }}
true

value property

{{ productAttribute.name }}:
{% if productAttribute.isCheckbox %}
    {% if productAttribute.value %} Yes {% else %} No {% endif %}
{% else %}
    {{ productAttribute.value }}
{% endif %}
Build-in battery: Yes
Capacity: 4000 mAh
Supported standards: Qi, Fast Charging

values property

{% if productAttribute.hasMultipleValues %}
    {{ productAttribute.name }}:
    {% for value in productAttribute.values %}
    - {{ value }}
    {% endfor %}
{% endif %}
Supported standards: 
    - Qi
    - Fast Charging

group property

{{ productAttribute.group.name }}
Battery specification

product property

{{ productAttribute.product.name }}
Super Phone