Structure
Because the main product handles the presentation, the sub-products need neither a description nor images. The details that distinguish them from one another are sufficient:
- Product name, for example “Tie”
- Product number
- Price
- Variants, if any, for example size and color
Where main and sub-products appear
Which of the two is visible depends on the template.
The last two rows have two consequences for data maintenance and for the behavior in the shop.
If a thumbnail is to appear in the basket, it must be stored on the sub-product. The image of the main product is not available there.
If the buyer follows the link to a sub-product from the search result, they land on the main product with all sub-products. If, on the other hand, they click “change” in the basket, the main product appears only with the sub-product to be changed.
Integration into the single product view
The display consists of two mutually exclusive areas. TheST-ParentProduct bracket decides which of them applies.
CAT-AdvData() addresses the sub-products as a list via the pseudo category index $ChildProducts. The second argument limits the number, in the example to 99. The loop {@[PR-Data](/en/v8s/referenz/tags/pr/grundlagen-und-produktdaten)} iterates through the list.
Only valid sub-products are counted and output. An inactive or deleted sub-product does not appear in the list, without leaving a gap.
If there is no valid sub-product, the entire CAT-AdvData area is omitted. When a basket item is changed, the list contains exactly the one sub-product to be changed.
