Using order line fields
When a product is added to a cart, it is created as an order line. Order line fields allows the customer to specify more information about an order before checkout.
Order line fields are specific to a certain product. For instance, if a customer wants certain measurements of a product e.g. cables or fabric, an order line field allows the customer to enter how many meters or inches they want of the product. The order line field can be implemented either on the products details page (Figure 1.1)
or in the shopping cart (Figure 1.2).
Setting up order line fields
Before you can use order line fields, you must:
- Create order line fields in the backend
- Configure one or more product groups to use the fields
- Implement the fields in your templates to render the fields in the frontend
After creating an order line field, you must attach it to a product group.
Implementing order line fields in the template
To render the order line fields in the frontend, you must add the following loop to your template if you want the fields to be on the products details page:
Or if you want them to be in your shopping cart
Notice that if you want the order line fields loop to be in the shopping cart, the loop should be placed inside the OrderLines loop as well. Rendering the order line fields in a shopping cart could look like this:
For more informations about the loops, see the Template Tags-site.