> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# CBPOD- (Enriching order data)

> The two tags for enriching order data: parse a separate template for each basket item and pass its content in the order data to the ERP system.

Sometimes the connected ERP system needs more for an order item than the order data provides by default. For this case, there is the CustomizedBasketPositionOrderData function, CBPOD for short.

It works like this: you store up to five templates of your own. The shop parses each of them for every single basket item, encodes the result in hexadecimal and writes it into the order data. You determine what goes into these templates using the familiar tag technique.

The two tags with the prefix `CBPOD-` are the bracket into which this content belongs.

Guide: Enriching order data

## The process

| Step | Where |
| - | - |
| Enter the templates in the `<Templates>` section of the shop configuration `shop.config`, as `CustomizedBasketPositionOrderData01` to `…05` | `shop.config` |
| Create the templates and fill them with tags | template directory |
| The shop parses each template once per basket item | at the time of the order |
| The result is written into the order data encoded in hexadecimal | order data |

> [!NOTE]
>
> This function does not require activation by WEBSALE AG. It is active as soon as at least one of the five templates is entered in the shop configuration.

> [!WARNING]
>
> The content ends up **hexadecimal-encoded** in the order data. It is not readable there, and the receiving system must decode it. Coordinate this before you start building.

## The complete example

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{CBPOD-PR-Data}
   {@CBPOD-PR-Data}

      ~BASKET-PR-Number~;~BASKET-PR-Name~;~BASKET-PR-Quantity~

      {CBPOD-PR-SetChildData}
         Set mit ~CBPOD-PR-SetChildData~ Unterprodukten:
         {@CBPOD-PR-SetChildData}
            ~BASKET-PR-Number~;~BASKET-PR-Quantity~
         {/@CBPOD-PR-SetChildData}
      {/CBPOD-PR-SetChildData}

   {/@CBPOD-PR-Data}
{/CBPOD-PR-Data}
```

> [!NOTE]
>
> Within the loop, all BASKET tags and all general WEBSALE tags are available. They are not limited to product data: customer data, existing JSON data or sending via asynchronous data transfer are also possible.

## CBPOD-PR-Data

The outer bracket and the loop in which the data of the basket item is compiled.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{CBPOD-PR-Data}
   {@CBPOD-PR-Data}
      <!-- die Daten dieser Position -->
   {/@CBPOD-PR-Data}
{/CBPOD-PR-Data}
```

> [!WARNING]
>
> The loop `{@CBPOD-PR-Data}` runs **exactly once**, not over all basket items. The shop parses the template once per item, and the loop provides the item concerned in this run. If you treat it like an ordinary item loop and count or sum within it, you get the same result of one for every item.

> [!NOTE]
>
> Why the loop exists at all: it sets the reference to the current item. Only within the loop do the BASKET tags know which item is meant. Without it, they return nothing.

### Checking the number of items

As an area tag, `CBPOD-PR-Data` accepts a number or a comma-separated list of numbers as a parameter. The area applies if the basket has exactly that many visible items.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{CBPOD-PR-Data(1)}
   <!-- greift nur bei genau einer Position im Warenkorb -->
{/CBPOD-PR-Data(1)}

{CBPOD-PR-Data(1,2,3)}
   <!-- greift bei einer, zwei oder drei Positionen -->
{/CBPOD-PR-Data(1,2,3)}

{!CBPOD-PR-Data(1)}
   <!-- greift bei jeder anderen Anzahl -->
{/!CBPOD-PR-Data(1)}
```

> [!NOTE]
>
> Without a parameter, the area applies as soon as the basket contains any visible items at all. The check for a specific number is intended for special cases, for example to pass single orders to the ERP system differently from collective orders.

> [!WARNING]
>
> The visible items of the entire basket are counted, not the set sub-products and not the item currently being processed.

## CBPOD-PR-SetChildData

Outputs the set sub-products of the item. Unlike the outer loop, this one actually runs over several entries.

| Usage | Result |
| - | - |
| Single tag | the number of set sub-products of this item |
| Area tag | applies if the item has set sub-products |
| Loop tag | runs over the set sub-products |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{@CBPOD-PR-Data}
   ~BASKET-PR-Number~

   {CBPOD-PR-SetChildData}
      {@CBPOD-PR-SetChildData}
         ~BASKET-PR-Number~;~BASKET-PR-Quantity~
      {/@CBPOD-PR-SetChildData}
   {/CBPOD-PR-SetChildData}

   {!CBPOD-PR-SetChildData}
      <!-- eine gewöhnliche Position ohne Set -->
   {/!CBPOD-PR-SetChildData}
{/@CBPOD-PR-Data}
```

> [!NOTE]
>
> Within the set loop, the BASKET tags refer to the respective sub-product; outside of it, to the set parent product. The switch happens automatically when entering and leaving the loop.

## What does not work on these templates

> [!WARNING]
>
> `BASKET-PR-Data` and `BASKET-PR-SetChildData` cannot be used on the CustomizedBasketPositionOrderData templates. They are replaced by exactly the two CBPOD tags. The other BASKET tags work as usual, but only within the CBPOD loops.

> [!WARNING]
>
> Both tags are permitted exclusively on the five CBPOD templates. On any other template, they are invalid.

> [!NOTE]
>
> If the internal calculation of the basket data fails, the shop hides all CBPOD areas and outputs nothing. The order data then contains an empty entry instead of an error message. Therefore, when setting up, check the actual result in the order data and not just the preview.

## The tags at a glance

| Tag | Single tag | Area tag | Negative area tag | Loop tag |
| - | - | - | - | - |
| `CBPOD-PR-Data` | – | yes | yes | yes |
| `CBPOD-PR-SetChildData` | yes | yes | yes | yes |

Both are only permitted on the templates stored in the shop configuration under `CustomizedBasketPositionOrderData01` to `…05`. `CBPOD-PR-SetChildData` additionally only within the loop `{@CBPOD-PR-Data}`.

## Related topics

* Guide: Enriching order data
* Guide: JSON interface
* Guide: Asynchronous Server-Side Events (ASSE)
* Reference: `<Templates>` section
* Reference: Items in the basket


## Related topics

- [Order data overview](https://dokumentation.websale.de/en/v8s/materialien/uebersicht-bestelldaten.md)
- [Enriching product data](https://dokumentation.websale.de/en/v8s/produkte/anreichern-von-produktdaten.md)
- [Data migration](https://dokumentation.websale.de/en/migration/daten-migration.md)
- [Orders and commissions](https://dokumentation.websale.de/en/v8s/referenz/tags/affiluser/bestellungen-und-provisionen.md)
- [API reference orders](https://dokumentation.websale.de/en/schnittstellen/admin-interface-api/api-referenz-bestellungen.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.