The rule grammar¶
Every rule Product Configurator can hold reads:
WHEN an option is a value | is one of several values [AND an option is a value …]
THEN <verb> <target>
Conditions are joined with AND and with nothing else. Two rules with the same target are already an OR, so write two rules where you mean one. Rules are not ordered: nothing about how a product resolves depends on which rule you wrote first.
Is one of¶
A WHEN line may pick several values of its option. The save stores it as one rule per value, identical but for that value and each with the same note, so the wood is one of oak, ash, walnut is three rules, and the tab reopens on those three. One such line per rule: once a line holds several values, the rule's other lines take one value each, because two lists would multiply into every combination of them. Two lines on the same option are not the same thing: they are joined with AND, so on a checkbox option they mean both ticked.
Verbs¶
| Verb | What it does |
|---|---|
hide |
The target is taken away while the conditions hold. An option that is hidden stops being required as well, whatever its own flag says, so there is no make optional verb to look for — and an answer already typed into it is kept, disabled, in case the rule stops firing. |
show |
The target is hidden until one of its show rules fires. Naming a target in a show rule is what makes it hidden by default, which is how the grammar says normally not offered without a second checkbox on another screen. |
require |
The target must be answered while the conditions hold. It flips OpenCart's own required flag, so the refusal, its wording and the control it appears against are all OpenCart's. It applies only to an option that ends up visible, so a rule that hides an option beats a rule that requires it. |
Where two verbs disagree about the same target, hiding wins. That is the only safe direction: the other one would let you build a product nobody can buy.
Targets¶
| Target | What it names |
|---|---|
the option (option) |
A whole option of the product — the control and every value in it. |
the value (value) |
One value of one option, leaving the rest of that option alone. This is the compatibility case: pick a motherboard, and the memory sizes it will not take disappear from the list rather than the list disappearing. |
require is the one verb with no value form: OpenCart carries a
required flag per option and none per value, so there is nothing for it to
flip on a single value.
What a condition may be written against¶
A condition names an option and one of its values, so only the option types whose answers are values you set in advance can hold one. Text, a date, a time and an uploaded file cannot: a condition on those would be matching whatever the customer typed.
| Option type | |
|---|---|
select |
A dropdown. One answer, from values you set in advance. |
radio |
A radio group. One answer, from values you set in advance. |
checkbox |
A checkbox group. Several answers at once, so is means is among the values ticked. |
A target may be an option of any type. It is only the WHEN side that is restricted — so a rule can perfectly well reveal an engraving text box, or require a file upload.