Account form
The account form is used to create or edit accounts. The form is usually included in the account form partial.
It can be used to create/edit normal customer accounts or trade accounts.
The account form should have its action attribute set to {{ global.current_url }}
Available fields
The form has the following text fields available. You should set the name attribute to that shown below
company
firstname
lastname
date_of_birth
email
password
phone
address_line1
address_line2
address_line3
city
zip
country_id
country_id
A <select> list of available countries should be presented to the user so that they can choose their country from a drop down.
<select name="country_id"> {% for country in countries %} <option value="{{ country.id }}">{{ country.name }}</option> {% endfor %} </select>
Required fields
The following fields are required:
firstname
lastname
email
password
Marketing
A field with the name marketing can be included with a value of 1 to add the customer to the marketing list.
customer_sources
If the customer sources/how you heard about us app is installed, a list of available customer sources, for the user to choose from, can be rendered as below.
<select name="source"> {% for customer_source in customer_sources %} <option value="{{ customer_source }}">{{ customer_source }}</value> {% endfor %} </select>
Editing accounts
The variable {{ global.customer.id }} can be used to detect whether a customer is logged into an account, and is therefore editing the account details rather than creating a new account.
The view has access to all of the attributes of the customer object to render data within the value attribute of a field for the existing data stored.
The password field is not a required field if the customer is editing their account. Submitting a blank value will keep the existing password.
trade customers
The variable {{ global.customer.trade }} will return true if the user is currently logged into a trade account or is on the URL /account/trade-application (the page where a user applies for a trade account).
Some additional fields are available on the account form for trade customers
additional_data0
additional_data1
additional_data2
additional_data3
additional_data4
These fields will post to the additional data fields visible when viewing a trade account.
The contents of these fields can be outputted using the variables shown below:
{{ global.customer.additional_data[0] }}
{{ global.customer.additional_data[1] }}
{{ global.customer.additional_data[2] }}
{{ global.customer.additional_data[3] }}
{{ global.customer.additional_data[4] }}
Trade customers
The fields below are available for trade customers creating an account through the /account/trade-application page.
mobile
website
vat_number