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

# DirectOrder

> Reference for WEBSALE direct order actions: enter products by article number, update entries and transfer the resulting list into the basket.

This section describes the available actions in the direct order area. With these actions, products can be entered directly into an order list by article number, updated, and transferred to the basket.

***

## Actions overview

| **Action**               | **Description**                                             |
| ------------------------ | ----------------------------------------------------------- |
| `DirectOrderAdd`         | Adds a product to the direct order list by article number.  |
| `DirectOrderUpdate`      | Updates the quantity of a product in the direct order list. |
| `DirectOrderDelete`      | Removes a product from the direct order list.               |
| `DirectOrderAddLines`    | Adds another input row to the direct order list.            |
| `DirectOrderDeleteLines` | Removes the last input row from the direct order list.      |

***

## Actions

### DirectOrderAdd

This action adds a product to the direct order list by article number. After successful execution, the product is displayed with its information in the list.

**Usage example**\
Can be used on the direct order page, where customers can quickly search for products by article number and add them to the order list without having to open the product detail page.

**Parameters**

| **Name** | **Description**                                |
| -------- | ---------------------------------------------- |
| `id`     | The article number of the product to be added. |

**Error codes**

| **Error code**           | **Description**                    |
| ------------------------ | ---------------------------------- |
| `errorsByField.id`       | Error in the article number input. |
| `errorsByField.quantity` | Error in the quantity input.       |

**Related modules, variables & methods**

* [\$wsDirectOrder](/en/frontend/referenz/module/wsdirectorder)
* [\$wsDirectOrder.items](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-items)
* [\$wsDirectOrders.currentLines](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-currentlines)

**Example** showing how a product is added to the direct order list via an article number input field.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionDirectOrderAdd = $wsActions.create("DirectOrderAdd", tag=string($myDirectOrderProduct)) }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionDirectOrderAdd.csrf }}">
    <input type="text" name="id" value="{{= $wsDirectOrder.items[$myDirectOrderProduct].id | ifNull('') }}">
    <button type="submit" name="wsact" value="{{= $myActionDirectOrderAdd.id }}">Search product.</button>
</form>
```

***

### DirectOrderUpdate

This action updates the quantity of a product in the direct order list.

**Usage example**\
Can be used on the direct order page when a customer wants to adjust the quantity of a product that has already been entered.

**Parameters**

| **Name**   | **Description**                  |
| ---------- | -------------------------------- |
| `quantity` | The new quantity of the product. |

**Error codes**

| **Error code**           | **Description**              |
| ------------------------ | ---------------------------- |
| `errorsByField.quantity` | Error in the quantity input. |

**Related modules, variables & methods**

* [\$wsDirectOrder](/en/frontend/referenz/module/wsdirectorder)
* [\$wsDirectOrder.items](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-items)

**Example** showing how the quantity of a product in the direct order list is updated via an input field.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionDirectOrderUpdate = $wsActions.create("DirectOrderUpdate", tag=string($myDirectOrderProduct)) }}
<input type="text" name="quantity" value="{{= $wsDirectOrder.items[$myDirectOrderProduct].quantity | ifNull('1') }}">
<button type="submit" name="wsact" value="{{= $myActionDirectOrderUpdate.id }}">Update product.</button>
```

***

### DirectOrderDelete

This action removes a product from the direct order list.

**Usage example**\
Can be used on the direct order page when a customer wants to remove a product from the order list.

**Parameters**

| **Name** | **Description**                                  |
| -------- | ------------------------------------------------ |
| `id`     | The article number of the product to be removed. |

**Error codes**

| **Error code**     | **Description**                    |
| ------------------ | ---------------------------------- |
| `errorsByField.id` | Error in the article number input. |

**Related modules, variables & methods**

* [\$wsDirectOrder](/en/frontend/referenz/module/wsdirectorder)
* [\$wsDirectOrder.items](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-items)

**Example** showing how a product is removed from the direct order list via a button.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionDirectOrderDelete = $wsActions.create("DirectOrderDelete", tag=string($myDirectOrderProduct)) }}
<button type="submit" name="wsact" value="{{= $myActionDirectOrderDelete.id }}">Remove product.</button>
```

***

### DirectOrderAddLines

This action adds another input row to the direct order list so the customer can enter more products at once.

**Usage example**\
Can be used on the direct order page when a customer wants to enter more products than there are currently input rows.

**Related modules, variables & methods**

* [\$wsDirectOrder](/en/frontend/referenz/aktionen/directorder)
* [\$wsDirectOrders.currentLines](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-currentlines)

**Example** showing how a new input row is added to the direct order list via a button.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionDirectOrderAddLines = $wsActions.create("DirectOrderAddLines") }}
<form method="post" action="{{= $wsViews.current.url() }}">
    <input type="hidden" name="wsact" value="{{= $myActionDirectOrderAddLines.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionDirectOrderAddLines.csrf }}">
    <button type="submit">Add row.</button>
</form>
```

***

### DirectOrderDeleteLines

This action removes the last input row from the direct order list. The action is only available if more than five rows exist.

**Usage example**\
Can be used on the direct order page when a customer has added too many rows and wants to remove them again.

**Related modules, variables & methods**

* [\$wsDirectOrder](/en/frontend/referenz/aktionen/directorder)
* [\$wsDirectOrders.currentLines](/en/frontend/referenz/module/wsdirectorder#\$wsdirectorder-currentlines)

**Example** showing how the last input row is removed via a button, provided more than five rows exist.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsDirectOrder.currentLines > 5 }}
    {{ var $myActionDirectOrderDeleteLines = $wsActions.create("DirectOrderDeleteLines") }}
    <form method="post" action="{{= $wsViews.current.url() }}">
        <input type="hidden" name="wsact" value="{{= $myActionDirectOrderDeleteLines.id }}">
        <input type="hidden" name="wscsrf" value="{{= $myActionDirectOrderDeleteLines.csrf }}">
        <button type="submit">Remove row.</button>
    </form>
{{ /if }}
```
