AForms uses an individual way, called “Labeling Logic”, to achieve conditional branches in the 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 the 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 the “Price Watcher” item.
The Price Watcher is a component that monitors the quoted price and attaches 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.
Adding a detail 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 AForms2.1.0.
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.
- Quantity Watcher
You can attach a label when the quantity specified for monitoring meets certain conditions (e.g., more than X). Enter the name of the label you want to attach in the “Labels” field.
Also, if you write more than two labels in the “Label” field, all of them will be attached to the user.
Components that can be controlled by labels
- Auto Item
Auto Item is a component that allows adding 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.
- Adjustment Item
Adjustment items are similar to Auto items and are components that allow you to add detail lines for discounts and premiums without showing the user the input fields. Adjustment items can also be controlled by labels. If you write the name of the label in the “Required Labels” field, AForms will only add a detail line if that label is attached.
- Option and Option with Quantity
The Option and the Option with Quantity 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)
- Quantity Item and Slider Item
The quantity item and the slider item are both components that allow the user to enter a quantity. These can also be controlled by labels. If you write the name of the label in the “Required Labels” field, the item will be displayed only if the user has that label.
Stop is a component to block the form submission. This can also be controlled by labels. If you write the name of the label in the “Required Labels” field, the form submission will be blocked if that label is attached.
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 “,”.
You can use label negation in situations where labels are read. Usually, it is “if the user has label X”, but with negation, it can be “if the user does not have label X”.
To negate a label, prefix the label with “!” before the label.
If there is more than one label, for example, “A, !B, C” means “if A, and not B, and C”.
Please note that negation can only be used in situations where labels are read (when components are controlled by labels).
You cannot use negation when attaching labels by components.