> ## 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.

# MDM- (Multiple delivery addresses)

> Build the management page on which the buyer distributes a basket item across several delivery addresses: destination selection, edit mode, buttons and messages.

When distributing an order across several delivery addresses, the buyer selects for each basket item where which quantity should go. There is a separate page for this, stored in the shop configuration `shop.config` in the `<Templates>` section under `MultiDeliveryManage`, usually `ws_multidelivery_manage.htm`.

The `MDM-` tags build this page. They provide the selection of the delivery destination, the switch to the edit mode of an address, the buttons and the messages. The addresses themselves and the basket items come from other prefixes, which are linked at the end of this page.

Guide: Selecting multiple delivery addresses · Reference: Templates section

## Selecting the delivery destination

The buyer has four options for where a partial quantity should go. All four are in a group of radio buttons with a common field name.

| Tag | Returns |
| - | - |
| `MDM-Destination_radioname` | the common field name of the group |
| `MDM-Destination_radiovalue_billingaddress` | the value for the billing address |
| `MDM-Destination_radiovalue_saveddelivaddress` | the value for a saved delivery address |
| `MDM-Destination_radiovalue_onetimedelivaddress` | the value for a one-time delivery address |
| `MDM-Destination_radiovalue_newdelivaddress` | the value for a new delivery address |

For each of the four values, there is a `radioselected` tag with the same name component. As a single tag, it outputs ` checked`; as an area tag, it takes effect for the selected option.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<label>
   <input type="radio" name="~MDM-Destination_radioname~"
          value="~MDM-Destination_radiovalue_billingaddress~"
          ~MDM-Destination_radioselected_billingaddress~>
   An die Rechnungsadresse
</label>

<label>
   <input type="radio" name="~MDM-Destination_radioname~"
          value="~MDM-Destination_radiovalue_saveddelivaddress~"
          ~MDM-Destination_radioselected_saveddelivaddress~>
   An eine gespeicherte Lieferadresse
</label>

{MDM-Destination_radioselected_saveddelivaddress}
   {@D-Data}
      <!-- Liste der gespeicherten Lieferadressen -->
   {/@D-Data}
{/MDM-Destination_radioselected_saveddelivaddress}
```

> [!NOTE]
>
> The `radioselected` tag thus has two tasks in one place. In the `input` element, it marks the selected entry; as an area tag below, it shows the matching selection list. This way, the list of saved addresses only appears if this option is actually selected.

> [!NOTE]
>
> The output of ` checked` starts with a space. You can therefore place the tag directly after the preceding attribute without adding one yourself.

## The edit mode

The same page shows two different things: either the selection of the delivery destination or the address fields of an address that is currently being changed. `MDM-EditMode` distinguishes between the two.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{MDM-EditMode}
   <h2>Lieferadresse ändern</h2>
   <!-- Adressfelder -->
   <button name="~MDM-EditMode_buttonname~" type="submit"
           value="~MDM-EditMode_buttonvalue_save~">übernehmen</button>
   <button name="~MDM-EditMode_buttonname~" type="submit"
           value="~MDM-EditMode_buttonvalue_cancel~">abbrechen</button>
{/MDM-EditMode}

{!MDM-EditMode}
   <h2>Wohin sollen wir liefern?</h2>
   <!-- Auswahl des Lieferziels -->
{/!MDM-EditMode}
```

> [!NOTE]
>
> Both buttons have the same name and differ only in their value. The shop system recognizes from the value whether to save or cancel. Therefore, use `button` with `value` and not two different field names.

> [!NOTE]
>
> The shop system remembers that the positive area tag was evaluated in the template. Therefore, keep it even if your page handles the edit mode differently.

## The page buttons

| Tag | Returns the field name for |
| - | - |
| `MDM-Button_OK` | the button that applies the selection |
| `MDM-Button_Back` | the button back to the basket |
| `MDM-Button_Reload` | the button that recalculates the page |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<input type="submit" name="~MDM-Button_Reload~" value="aktualisieren">
<input type="submit" name="~MDM-Button_Back~" value="zurück">
<input type="submit" name="~MDM-Button_OK~" value="übernehmen">
```

> [!NOTE]
>
> All three only return the field name, not the label. You define the visible text yourself in the `value` attribute.

## Messages and errors

| Tag | Meaning |
| - | - |
| `MDM-Notify_error` | outputs the error code; takes effect as an area tag in case of an error |
| `MDM-Notify_cancel` | takes effect if the buyer canceled entering another delivery address |
| `MDM-Notify_EditOK` | takes effect if no error occurred while editing |
| `MDM-Notify_Editerror` | outputs the error code of the editing operation |

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{!MDM-Notify_EditOK}
   <p class="fehler">Die Änderung ist fehlgeschlagen (Code ~MDM-Notify_Editerror~).</p>
{/!MDM-Notify_EditOK}

{MDM-Notify_cancel}
   <p class="hinweis">Es wurde keine weitere Lieferadresse angegeben.</p>
{/MDM-Notify_cancel}
```

### Checking for a specific error

As an area tag, `MDM-Notify_error` accepts an error code in the argument and only takes effect for exactly this code.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{MDM-Notify_error(3)}
   <p class="fehler">Für diese Adresse ist die Mindestmenge nicht erreicht.</p>
{/MDM-Notify_error(3)}

{MDM-Notify_error}
   {!MDM-Notify_error(3)}
      <p class="fehler">Es ist ein Fehler aufgetreten (Code ~MDM-Notify_error~).</p>
   {/!MDM-Notify_error(3)}
{/MDM-Notify_error}
```

> [!NOTE]
>
> This option is not described in the previous documentation. Without an argument, the area tag takes effect for every error; with an argument, only for the one specified. This lets you formulate understandable messages instead of outputting a bare number.

> [!WARNING]
>
> Which code has which cause is not documented. Until this is clarified, also output the code so that support can work with it.

## The tags at a glance

| Tag | Single tag | Area tag | Negative area tag | Loop tag |
| - | - | - | - | - |
| `MDM-Button_OK` | yes | – | – | – |
| `MDM-Button_Back` | yes | – | – | – |
| `MDM-Button_Reload` | yes | – | – | – |
| `MDM-Destination_radioname` | yes | – | – | – |
| `MDM-Destination_radiovalue_billingaddress` | yes | – | – | – |
| `MDM-Destination_radiovalue_saveddelivaddress` | yes | – | – | – |
| `MDM-Destination_radiovalue_onetimedelivaddress` | yes | – | – | – |
| `MDM-Destination_radiovalue_newdelivaddress` | yes | – | – | – |
| `MDM-Destination_radioselected_billingaddress` | yes | yes | yes | – |
| `MDM-Destination_radioselected_saveddelivaddress` | yes | yes | yes | – |
| `MDM-Destination_radioselected_onetimedelivaddress` | yes | yes | yes | – |
| `MDM-Destination_radioselected_newdelivaddress` | yes | yes | yes | – |
| `MDM-EditMode` | – | yes | yes | – |
| `MDM-EditMode_buttonname` | yes | – | – | – |
| `MDM-EditMode_buttonvalue_save` | yes | – | – | – |
| `MDM-EditMode_buttonvalue_cancel` | yes | – | – | – |
| `MDM-Notify_error` | yes | yes | yes | – |
| `MDM-Notify_cancel` | – | yes | yes | – |
| `MDM-Notify_EditOK` | – | yes | yes | – |
| `MDM-Notify_Editerror` | yes | – | – | – |

All tags apply on the template for managing multiple delivery addresses.

> [!NOTE]
>
> The shop system does not reject `MDM-Notify_cancel` and `MDM-Notify_EditOK` as single tags, but then outputs nothing. Use both as area tags.

## Tags of other prefixes on this topic

The function spans several pages of the shop. The remaining tags are described under their respective prefix.

* **Basket page**: the distribution per item, the sample copies and the additional costs are described under BASKET- (Multiple delivery addresses and sample copies)
* **Address selection**: the `mdm` variants of `D-DeliverySelection`, the one-time addresses and the usage checks are described under D- (Delivery address)
* **Form**: `FORM-MDM` is described under FORM- (Forms)
* **Page states**: `ST-MultiDeliveryManagePage`, `ST-MultiDelivery_OK` and the other `ST-` tags of this function are described under ST- (Page states)
* **Availability**: `WS-MultiDelivery_available` and the two `WS-DelivAddr` tags are described under WS- (General tags)

## Related topics

* Guide: Selecting multiple delivery addresses
* Guide: Creating shipping methods
* Reference: D- (Delivery address)


## Related topics

- [Multiple addresses: tags per template](https://dokumentation.websale.de/en/v8s/referenz/tags/multiple-adressen.md)
- [D- (Delivery address)](https://dokumentation.websale.de/en/v8s/referenz/tags/d-lieferadresse.md)
- [Multiple delivery addresses and sample copies](https://dokumentation.websale.de/en/v8s/referenz/tags/basket/mehrfach-lieferadressen-und-belegexemplare.md)
- [Shipping and delivery](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/versand-und-lieferung.md)
- [Styles for customer and addresses](https://dokumentation.websale.de/en/v8s/referenz/styles/kunde-und-adressen.md)


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