Skip to main content
With direct ordering, the buyer enters the product numbers of the desired products in an order form. They can then add all entered items to the basket with a single click. The prerequisite is that the customer has the corresponding product numbers, for example from a catalog. Nothing else is required for this. No additional scripts are needed.

Keep direct order entries during a session

The shop stores the products checked during a direct order that have not yet been added to the basket in the session. The cookie only contains the reference to the session. If saveCountInSession is enabled under checkout.directOrder, the shop also remembers the current number of input lines there. If the direct order form is called up again later, the stored product data is automatically filled into the corresponding input fields. This avoids having to re-enter the product number and quantity if the shop visitor has not yet added their selection to the basket but has visited other pages of the shop first.

Actions

The following actions are available:

DirectOrderAdd

This action checks the entry of a line and adds the product to the order form list. It does not add anything to the basket. There is a separate step for that, see Add items to the basket.

DirectOrderDelete

This action removes a line from the order form list. The basket is not affected.

Integration of the direct order

Create template

Create a new file directOrder.htm in the views/modules directory. In this file, several rows are generated for the respective order items.

Error messages

The error messages can be placed either before or inside the form element. The DirectOrderAdd action does not report all errors on the same field:
  • Errors relating to the quantity are found under errorsByField.quantity.
  • Errors relating to the item number and the product are found under errorsByField.id.
  • Errors of the item number fields from itemNumberFields are found under the name of the respective input field. This applies to itemNumberCheckFailed and to missingId for an empty required field.
In this example, error messages are displayed if the quantity of an item is entered incorrectly.
In this example, error messages are displayed when adding an item. The second loop additionally outputs the errors of the item number fields. The type check is necessary because itemNumberFields also contains separators, and these have no name.
The output per item number field supplements the output of errorsByField.id; it does not replace it. If the combined item number cannot be assigned to a product, the action reports invalidId on the id field. This also applies if the line does not contain an id input field at all.

Add items to the basket

A separate form adds the entered items to the basket using the BasketItemAdd action. For each item, a hidden field named multiProducts.<product number>.quantity is submitted. If insert codes are active, the field multiProducts.<product number>.insert is submitted as well. Without this step, an order is never created.
For more information, see Transfer items to the basket in the module reference. You can integrate the link to the direct order in any template. It is: