Forms are essential part of ecommerce. Below is a list of all availabe forms in Finqu with simple examples. To test whether the form was posted succesfully form exposes a variable
{% if form.posted_successfully? %}
To check for errors check the variable form.error
.
change_customer_password
Available when user is logged in. Changes customers password.
{% form "change_customer_password" %}
<input type="password" name="password">
<input type="password" name="confirm_password">
{% endform %}
comment
Adds a comment to article or to a comment. Exposes logged in customers name as variable.
{% comment %}Pass in article or comment as an argument{% endcomment %}
{% form "comment", article %}
<input type="text" name="name" value="{{ form.name }}">
<input type="text" name="comment" value="">
{% endform %}
contact
Contact form to send an email to the merchant.
{% form "contact" %}
<input type="email" name="email" value="">
<input type="text" name="message" value="">
<input type="text" name="name" value="">
<input type="text" name="phonenumber" value="">
<input type="text" name="subject" value="">
{% endform %}
cookie_policy
Cookie consent form. Cookie policy setting can also be accessed from global variables.
{% form "cookie_policy" %}
{% if form.cookie_policy == nil %}
<input type="hidden" name="cookie_policy" value="all">
<button type="submit">Accept all cookies</button>
{% else %}
<p>Cookies checked!</p>
{% endif %}
{% endform %}
create_customer
Creates a new customer.
{% form "create_customer" %}
<input type="email" name="email" value="">
<input type="password" name="password">
<input type="password" name="password_confirm">
{% endform %}
customer
Subscribes to a newsletter, if you define first_name and last_name, this will also create a customer but then you will need to define accepts_marketing too in the form data to subscribe user to the newsletter.
{% form "customer" %}
<input type="email" name="email" value="">
{% endform %}
edit_customer
Edit customer information.
{% form "edit_customer" %}
<input type="text" name="first_name" value="{{ form.first_name }}">
<input type="text" name="last_name" value="{{ form.last_name }}">
<input type="text" name="address_1" value="{{ form.address_1 }}">
<input type="text" name="address_2" value="{{ form.address_2 }}">
<input type="text" name="city" value="{{ form.city }}">
<input type="text" name="zipcode" value="{{ form.zipcode }}">
<select name="country">
{{ country_option_tags }}
</select>
<input type="text" name="phonenumber" value="{{ form.phonenumber }}">
<input type="text" name="email" value="{{ form.email }}">
<input type="checkbox" name="accepts_marketing"{{ form.accepts_marketing | yepnope: ' checked': '' }}">
<input type="text" name="company" value="{{ form.company }}">
<input type="text" name="vat_number" value="{{ form.vat_number }}">
<input type="text" name="company_id" value="{{ form.company_id }}">
{% endform %}
localization
Edit locale, only sent values are updated. You can pass customer as an argument to update customer preferences.
{% form "edit_customer" %}
<select name="country_code">
{% for country in form.available_countries %}
<option value="{{ country.iso_code }}">{{ country.name }}</option>
{% endfor %}
</select>
<select name="locale_code">
{% for locale in form.available_locales %}
<option value="{{ locale.iso_code }}">{{ locale.name }}</option>
{% endfor %}
</select>
<select name="currency_code">
{% for currency in form.available_currencies %}
<option value="{{ currency.iso_code }}">{{ currency.name }}</option>
{% endfor %}
</select>
{% endform %}
login
Login user.
{% form "login" %}
<input type="email" name="email" value="">
<input type="password" name="password">
{% endform %}
product
Add product to cart.
{% form "product", product %}
<input type="product" value="1">
{% endform %}
recover_customer_password
Order password recovery instructions.
{% form "recover_customer_password" %}
<input type="email">
{% endform %}
reset_customer_password
Reset password.
{% form "recover_customer_password" %}
<input type="hidden" name="key" value="{{ form.key }}">
<input type="hidden" name="email" value="{{ form.email }}">
<input type="password" name="password">
<input type="password" name="confirm_password">
{% endform %}
review
Review a product.
{% form "review", product %}
<input type="text" name="title" value="">
<input type="text" name="comment" value="">
<input type="text" name="name" value="">
<input type="number" name="rating" value="1">
{% endform %}
search
Review a product.
{% form "review", product %}
<input type="text" name="title" value="">
<input type="text" name="comment" value="">
<input type="text" name="name" value="">
<input type="number" name="rating" value="1">
{% endform %}
store_password
Login to password protected store
{% form "store_password", product %}
<input type="password" name="password" value="">
{% endform %}