Originally published on our blog.
Idea
A common request we have received from our customers is to support more than 8 features. Until now, the recommended approach has been to use the notes field or data object fields to store any additional feature information. With this update, the dashboard and several of our clients have built in support for additional features. In addition to being able to define any number of features, we have also made it possible to define feature hierarchies. For example, we can define the following feature hierarchy:
Set up
Defining features
Simple hierarchy
Let’s suppose we want to define the following feature hierarchy:
Adding submodules
Suppose now that we want to add sub features to ModuleB. For example, Submodule 1 and Submodule 2. To do that, we introduce a new array instead of the string “Module B”, which has the following structure:Another example with sub modules
We can keep adding submodules to submodules in a similar fashion. For example, to express the following features:
How to add a template to a product
To add your feature template to a product, you can click on Edit Feature Names on the product page and then scroll down until you see Feature Template. In the example below, we would get the following feature hierarchy
Assigning features
Once you have defined the feature template, the page to create a new license key and to edit existing one will have a box that allows you to define them, as shown below. The state will be stored in a data object with the name cryptolens_features, which we will cover in the next step.
Verifying features
You can verify that a certain feature exists usingHelpers.HasFeature
. For example, to check if Submodule1 is present, the following code can be used:
Examples
The modules below: