The two counter families differ fundamentally: you reset the DesignControl counters yourself and increment them deliberately to build conditions. The WS counters only run forward and are used for numbering.
Showing areas depending on counter values
The DesignControl countersDC-Counter1 to DC-Counter3 are at 0 on every page call. They can be incremented and reset as often as you like. The value is checked with the area tag of the same name.
There are exactly three counters.
DC-Counter4 and higher return nothing.The area tag can contain several values, separated by commas.
{DC-Counter1(0,2,4)} applies for each of these three values.Example: showing the first available product list
A special list is to appear at the bottom of the product detail view. The first choice is Bought-Together products. If there are none, accessory products should appear, and if those are missing too, complementary products. Exactly one of the three lists should be shown in the end. The counter keeps track of whether something has already been output.The last block no longer increments the counter. This is not an oversight: it is not queried afterwards. If you later add a fourth list, you must add the
~DC-Counter1_inc~ there.Numbering elements in loops
Within a loop, each element often needs its own number, for example for a unique HTML ID or for alternating class names. There are two independent counters for this.
Both are at 0 on every page call and can only be incremented, not reset. This means they deliver unique numbers across an entire page.
WS-Counter and WS-Counter2 are two separate counters. You can use both at the same time on the same page without them interfering with each other.Sequential numbering
A gallery view should give each tile its own class so that, for example, the third column can be addressed differently.category_box_1, category_box_2, category_box_3 and so on.
Unique IDs
An ID may only appear once on a page. In a loop over grouping products, the counter creates a separate ID for each form.Alternating numbering with modulo
WS-Counter2 and WS-Counter2Inc accept a number as an argument. In that case, not the counter value is output, but its remainder when divided by this number.
category_td_1 and category_td_2, i.e. a color change from row to row.
The value range is between 1 and the argument, both inclusive.
WS-Counter2Inc(3) therefore returns 1, 2, 3, 1, 2, 3 and never 0. This differs from the usual modulo calculation, which would yield 0 to 2, and is exactly what you need for class names.Showing areas depending on strings
DC-CompareStringInList checks whether a string appears in a list of strings. Both arguments support tag-in-tag, so you can use tags instead of fixed texts.
This is how a German shop shows buyers with Austria as their billing country a notice about the Austrian shop.
The outer bracketing with
A-CountryISO is not superfluous. It ensures that nothing is checked at all as long as the customer has not yet selected a billing country.The tag only exists as an area tag and in the negated form. As a single tag, it returns nothing.
Related topics
- Basics: Basics of tags
- Guide: Using free parameter tags
- Reference: DC-Int1…3
