Product features
In the enfore platform, products have various properties that are explicitly modeled in the Product
data structure and its subresources. For example, the product's name, management unit, sales price/quantity, etc.
Naturally, not all properties of every product in the world can be modeled. Trying to do this would work against the goal of the "MetaCompany" model being suitable to all kinds of businesses. Therefore, the enfore platform has a generic way to express custom product properties by the way of "product features".
In short, "product features" allow custom properties to be declared by the merchant for any of his products. Those custom properties can be organized in various ways and can be configured to be shown in different UI contexts as needed by the merchant.
The domain model for "product features" mainly consists of the data types FeatureTemplate
, ProductFeature
and various types of FeatureValue
/FeatureValues
.
A FeatureTemplate
exists independent of any Product
and describes a custom property (without actually assigning it to any Product
yet). The template has a name, type, value type, a list of possible values and various additional information. For example, a tailer shop might define a feature template named "Color" with the type COLOR
and the possible values of "Red"
, "Green"
, and "Black"
. And it might also define a feature template named "Arm length" with the type SIZE
and the possible "length" values of 30cm
and 26cm
.
Note that the "possible values" declared as part of a FeatureTemplate
consist of both the definition of the value type and the definition of the actual values. The type is mandatory and static but the actual values may change over time.
In addition to the type
, feature templates can also be organized by category
and group
. Categories are predefined by enfore (currently only SPECIFICATIONS
and INGREDIENTS
exist) whereas groups can be defined by the merchant (although enfore does provide a couple of pre-defined groups, e.g., "allergens" or "dietary information").
Once a feature template has been defined, a Product
can declare a ProductFeature
to define that "this product has that feature/that custom property". The ProductFeature
references a FeatureTemplate
and (optionally) specifies a value (from the ones allowed by the template). E.g., the "Green Shirt" product may have the features "Color" with value "Green"
and "Arm length" with value 26cm
.
The value in the ProductFeature
is optional so we can support some advanced use cases:
- Products with variants (where the variants are implicitly defined by feature value combinations)
E.g., Product "T-Shirt" with variant-defining features "Color" (values red, green, blue) and "Size" (values S, M, L) would have the 6 variants red/S, red/M, red/L, green/S, green/M, green/L, blue/S, blue/M, and blue/L - Products with feature values that differ by Lot
E.g., Product "Red Roses" with feature "Stem length" defined "per Lot"
Feature types & values
Each product feature must be assigned a type
and a value_type
. Most also have a list of possible values (in the template) and a value (in the product/lot).
Since product features are effectively object properties, they always have some kind of value, at least from an abstract interpretation.
Take for example a product like a "Shopping bag". It could have the following properties:
- Material = Cotton
- Base color = Grey
- Highlight color = Red
- Weight = 350g
- Volume capacity = 10l
- Weight capacity = 15kg
- Size = M
- Food safe = yes
- Washable = yes
The type
of a feature defines the semantic type of the feature's value. The following feature types exist:
Feature type | Description |
---|---|
CAPACITY | Feature describes a capacity. E.g., the bag's volume or weight capacity. |
COLOR | Feature describes a color. E.g., the bag's base and highlight color. |
FORM_FACTOR | Feature describes a form factor. E.g., the bags shape. |
TAG | The feature serves a label. E.g., the "food safe" or "washable" lables on the bag. |
MATERIAL | Feature describes a material. E.g., the bag's material. |
PERFORMANCE | Feature describes a performance characteristic. E.g., a car's speed or a pump's throughput. |
SIZE | Feature describes a size. E.g., the bag's size or weight. |
OTHER | The "catch-all" type if none of the others match. |
The value_type
of a feature defines the technical type of the feature's value. The following feature value types exist:
Feature value type | Description |
---|---|
ABSTRACT | The value is a string |
BOOLEAN | The value is a boolean . |
INTEGER | The value is an integer number . |
NUTRITION_DECLARATION | The value is a NutritionDeclaration . |
QUANTITY_DIGITAL_STORAGE | The value is a Quantity with the unit being one of the DIGITALINFORMATION_… units. |
QUANTITY_ENERGY | The value is a Quantity with the unit being one of the ENERGY_… units. |
QUANTITY_LENGTH | The value is a Quantity with the unit being one of the LENGTH_… units. |
QUANTITY_MASS | The value is a Quantity with the unit being one of the MASS_… units. |
QUANTITY_PIECES | The value is a Quantity with the unit being QUANTITY . |
QUANTITY_VOLUME | The value is a Quantity with the unit being one of the VOLUME_… units. |
TEXT | The value is a longer text as a string |
NONE | The feature has no value. |
Note that the feature type limits the allowed feature value types:
Feature type | Allowed feature value types |
---|---|
CAPACITY | ABSTRACT , INTEGER , QUANTITY_PIECES , QUANTITY_LENGTH , QUANTITY_VOLUME , QUANTITY_MASS , QUANTITY_ENERGY , QUANTITY_DIGITAL_STORAGE |
COLOR | ABSTRACT |
FORM_FACTOR | ABSTRACT |
MATERIAL | ABSTRACT |
PERFORMANCE | ABSTRACT |
SIZE | ABSTRACT , INTEGER , QUANTITY_PIECES , QUANTITY_LENGTH , QUANTITY_VOLUME , QUANTITY_MASS , QUANTITY_ENERGY , QUANTITY_DIGITAL_STORAGE |
TAG | NONE |
OTHER | ABSTRACT , BOOLEAN , INTEGER , QUANTITY_PIECES , QUANTITY_LENGTH , QUANTITY_VOLUME , QUANTITY_MASS , QUANTITY_ENERGY , QUANTITY_DIGITAL_STORAGE , TEXT |
Feature categories & groups
To organize features, merchants can use feature categories and feature groups. Both are use to determine which features are displayed where in the UI. For example, the product info view will use a tab for each category and then group the features of each tab by feature group.
Feature display configuration
Giving merchants the option to declare custom properties for their products is only useful if those custom properties are also visible in the client UI and/or on business documents.
For this, each FeatureTemplate
and ProductFeature
provide a "display configuration".
A FeatureDisplayConfiguration
allows the merchant to choose an icon (from the list of built-in icons) and a color (from the list of defined "highlight colors") and specfiy a list of "UI contexts" in which the feature shall be shown.
The configuration on the FeatureTemplate
serves as a blueprint for the configuration on the ProductFeature
. It is copied from the FeatureTemplate
on creation of the ProductFeature
but is then "detached" from it (i.e., the configuration on the ProductFeature
doesn't update when the configuration on the related FeatureTemplate
is modified). For the actual display, only the configuration on the ProductFeature
is taken into account.
Icons
The enfore platform defines a right set of icon to choose from.
Since there are too many icons to list them all here (and the icon set gets extended all the time), please refer to the source repo.
Colors
The enfore platform currently defines six highlight colors to choose from:
GLUE
GOLDEN
PURPLE
TEAL
YELLOW
When no specific color is chosen by the merchant, a generic fallback color is automatically used.
Display contexts
The enfore platform defines the following display contexts for product features:
Context | Description |
---|---|
PRODUCT_LISTING_IN_REGISTER | Product selection views (list/card modes only) in the register. |
LINE_ITEMS_IN_ACTIVE_ORDERS | Line items in orders in the register. |
LINE_ITEMS_IN_ORDER_MANAGEMENT_AND_HISTORY | Line items in orders in sales history and order management views. |
PRODUCT_INFO_VIEW | Product info view in register an invoicing. |
SALES_ORDER_BUSINESS_DOCUMENTS | Line items in business documents. |