AForms uses an individual way, called “Labeling Logic”, to achieve conditional branch in automatic quotation.
The basic idea is “When a user does something special, attach a label on him/her”.
Then, “The form controls the components by looking at the labels attached to the user”.
It would be easier to explain with actual examples, so here are some examples.
Case 1: To provide an additional option in a later item only to users who selected a specific option
For example, in the customization form of a BTO PC like Dell’s, the logic is that only users who choose Windows 10 Pro can select 32GB memory.
In this case, set up the form so that if a user chooses Windows 10 Pro as OS, AForms will attach the label “pro-edition” to the user.
Then, when selecting memory, only if the user has the “pro-edition” label, they can choose 32GB memory.
To actually create a form in this way, enter “pro-edition” in the “Label” field of the Wondows10 Pro Option.
Then fill in the “Required Label” field of the 32GB memory Option with “pro-edition” again.
Case 2: To give a discount to users whose quoted price is above a certain amount
In this case, please use “Price Watcher” item.
The Price Watcher is a component that monitors the quoted price and attach a label to the user if it meets the specified criteria.
For example, if the quoted price is more than $1,000, the “large-price” label can be attached.
To add a details line to the quotation only when it has a specific label, you need to use “Auto Item” with “Required Labels”.
For example, the name could be “Discount”, the price could be “-50”, and the Required Labels field could be “large-price”.
Then only the users labeled “large-price” can have the $-50 details line added in the name of the discount.
Labels and Components
This information is current as of AForms 1.2.11.
Components that can be used to attach labels
In the Option of Selector Item, when the user selects an option, the labels of that option will be attached. Please enter the name of the label you want to attach in the “Labels” field.
- Price Watcher
Labels can be attached when the quoted price meets certain conditions (e.g. more than $100). Please enter the name of the label you want to attach in the “Labels” field.
Components that can be controlled by labels
- Auto Item
Auto Item is a component that allows to add a detail line without showing the user the input field. This can be controlled by labels.
If you write the name of a label in the “Required Labels” field, the AForms will add a detail line only if that label is attached to the user.
The Option of the Selector Item can be controlled by labels.
If you enter the name of the label in the “Required Labels” field, the Option will be enabled only if that label is attached. (If the label is not attached, it will not be selectable)
Also, if you write more than two labels in the “Required Labels” field, the condition will not be fulfilled until all of them are attached to the user.
- The characters that can be used for labels are alphabets, numbers, hyphen “-“, and underscore “_”.
Any spaces ” ” before or after the label name will be removed from that.
- When writing multiple labels, please separate them with a comma “,”.