1and1 Help Centre Categories

print article

How to collect additional information when shoppers place an order

To add additional fields to get information from the shopper, the create the
following rule under 'Settings' -> 'Advanced Settings' -> 'Payment methods' -> 'Rules for the order pages'Here you should see Rule for the second order page($RULE_ORDERPAGE_2)add_field(array("fieldname" => "age_field",
"fieldname_text" => "Your Age",
"typ" => "textfield(size=25):Please enter your age!!",
"validator" => ".+",
"customerfield" => true));

What the fields mean:

fieldname Internal field name as displayed
in the order book; spaces and special symbols are not permitted.
fieldname_text Name of the field that is
displayed in front of the field.
typ "Selection: A | B | C", "textfield[(HTML
code)]:", "textarea[(HTML code)]:" etc. similar to the item attributes.
textfield, textarea may contain HTML code in parentheses after the key word
that is inserted in the HTML code. The pre-set values for the field appear
after the colon.
validator Regular term for checking the
field, e.g. you can use ".+" to make it mandatory field. If "validator" is
left empty, no check will be made - the field is optional. (Can be omitted)
customerfield If true, then the field will
also be incorporated in the customer record (when a customer registers). If
false it will only be saved with the order.

Note: The additional fields appear *after* the address information is
entered by the shopper.

OTHER EXAMPLES OF 'typ' FIELD1. Textfield:add_field(array("fieldname" => 'textfield01',
"fieldname_text" => "Age",
"typ" => "textfield(size=20):Your entry"
));

If you want it as HTML code: <form>
Age: <input type="text" name="orderinfo[custom_textfield01]" value="Your entry" size="20" />]
</form>

Would look like this:

Age:
2. Textarea: add_field(array("fieldname" => 'textarea01',
"fieldname_text" => "Your Comments:",
"typ" => "textarea(cols=20 rows=5): Please enter your comments"
));

If you want it as HTML code: <form>
Your Comments: <textarea name="orderinfo[custom_textarea01]" cols="20" rows="5" > Please enter your comments </textarea>
</form>

Would look like this:

Your Comments:
3. Data that the customer cannot change: add_field(array("fieldname" => "readonly01",
"fieldname_text" => "Additional Data:",
"typ" => "readonly:Data (any)"
));

If you want it as HTML code: Additional Data: <input type="hidden" name="orderinfo[custom_readonly01]" value="Data (any)" />

Would look like this:Additional Data: Data (any)

4. Data the customer can select from a list:add_field(array("fieldname" => 'selection01',
"fieldname_text" => "Please Select:",
"typ" => "selection:choice 1|choice 2|choice 3|choice 4|choice 5"
));

If you want it as HTML code: <form>
Please Select:<select name="orderinfo[custom_selection01]">
<option value="choice 1">choice 1</option>
<option value="choice 2">choice 2</option>
<option value="choice 3">choice 3</option>
<option value="choice 4">choice 4</option>
<option value="choice 5">choice 5</option>
</select>
</form> Would look like this:

Please Select: