Conditions

As product lists data sometimes must be displayed conditionally, the myShop additional system has various ways of checking certain conditions. Some conditions are directly linked to the row’s status, whereas others may be applied more generally. One example of a condition dependent on rows – also called row context -, is the myshop-has-value:< n > condition. The notation of row context conditions is almost similar to those recalling values, the difference being that the condition checks for the presence of values. This makes it possible to show the value of rows only when the rows do have values entered – see example below -.

<tr style="myshop-has-value:1">
        <td style="myshop-label:1"/>
        <td style="myshop-value:1;font-size:10;font-weight:bold"/>
</tr>

In this example the title of column one and the value of the first columns – the active row – is only displayed when the value is not empty. The empty value is a null value of no value – an empty string -. The myShop additions system knows a number of so-called myshop-has conditions – see the reference list for description -. Each myshop-has knows a myshop-not-has addition to be used for the opposite statement.

In addition to checking the values or the on/off functions – for instance myshop-has:menu – there are also conditions, which change style immediately. Depending on the index of the active row a colour value is chosen – see example below -.

<tr style="myshop-has-value:1">
        <td style="myshop-label:1"/>
        <td style="myshop-value:1;myshop-color-even:red;myshop-color-odd:green;"/>
</tr>

In this example the text colour of the field is dependent on the row number. If the value is an even value – 0,2,4 etc.- then the text colour will be red. For the odd rows the text colour will be green.

The latter form for conditional implementation is the most extensive one. The addition used for this condition is myshop-test:< condition >. This enables advanced check-ups. Logical operations such as: and, or and not can be used, the operation mod and the comparisons ==,<, >, <= of >=. This may be combined with system variable and functions – see reference list, subdivision variables and functions – .

In the example below you will find the use of myshop-test. The example only shows a field when it has the value ‘show-me’. The notation { 1 } or { title } is used to recall the field’s value and to compare it to the string ‘show-me’.

<tr style="myshop-test:{ 1 } == 'toon mij'">
        <td style="myshop-label:1"/>
        <td style="myshop-value:1"/>
</tr>

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment