User defined fields

Store your own product data with global custom fields, taxonomies and field groups per category, import values from tables and show them in templates.

Custom fields let you store your own product data, such as weight, warranty or pump pressure, and show it in product boxes, data sheets and comparison tables. You need no extra plugin like ACF or Meta Box; the fields are made for product data and work directly with the affiliate-toolkit templates.

The feature comes with the Custom Fields module, which is included in the affiliate-toolkit passes. Install and activate it like every other module and enter your license under Settings → Licenses. There are two kinds of fields: global fields for every product and field groups for the products of one product category.

Global custom fields

Global fields are available for every product, regardless of its category. Use them for data that all your products share, for example warranty, weight or your own test verdict. You find them under affiliate-toolkit → Settings → Custom fields.

  1. Click Add Field.
  2. Enter a Caption (the visible label).
  3. Enter a Name. It becomes the placeholder customfield_NAME. Invalid characters are cleaned up; if you leave it empty, a number is used. Pick a clear name and do not change it later.
  4. Choose the Type and, if needed, the Format (see the tables below).
  5. Click Save Changes.
Settings tab Custom fields with three global fields (Warranty, Weight, Test verdict) with name, type and format, and the empty section for custom taxonomies
Global fields and custom taxonomies in the settings.

Custom taxonomies

Below the fields you can create taxonomies. They work like post categories: a product can get one or several terms, and you can filter by them. Enter a Caption, a Caption (plural) for the backend and a Name. The placeholder is customtaxonomy_NAME.

Renaming a taxonomy later is not supported. After you add or change taxonomies, save the permalinks once (Settings → Permalinks → Save Changes).

Field types and formats

TypeWhat it does
TextSingle-line text box. The format decides how the input is checked and shown.
MultilineMulti-line text box for longer plain text.
DropdownSelection from fixed values. Global fields: values in the Format column, separated by semicolons (for example 1 kg;2 kg). Field groups: one value per line in "Dropdown values".
Yes/NoChoice of Yes, No or none. The output is a green tick or a red cross; with the format "text" it is the word Yes or No. The Compare Table settings let you replace the icons with your own text or HTML.
HtmlWordPress editor for formatted text, links and images.
TaxonomyOnly in field groups: creates a taxonomy (like a category) with that name. Products can get several terms, and you can filter by them.

The format refines a text field. In global fields you type it into the Format column; in field groups you pick it from a list.

FormatEffect
Default / textPlain text.
numberOnly numbers are accepted. Use it together with prefix or suffix for units, so values can be compared and filtered.
urlA URL is expected.
dateDate (field groups only).
emailE-mail address (field groups only).
starsA rating from 0 to 5 that is shown as stars.

Field groups

Field groups hold fields that only make sense for one kind of product. For a tool comparison you would create groups such as "Planer", "Cordless screwdriver" and "Drill", each with its own fields. A group is assigned to one or more product categories, and every product in those categories shows the group's fields.

  1. Open affiliate-toolkit → Field groups and click Add new field group.
  2. Enter a title and add the fields with Add Field.
  3. Tick the product category in the Product category box on the right.
  4. Fill in the group information below the fields and click Publish.
Field group "Coffee machine specs" with the fields pump pressure, water tank, milk frother, integrated grinder and power, assigned to the product category Coffee machines
A field group for coffee machines.

Settings of a field

SettingMeaning
CaptionLabel shown in the backend and, for example, in comparison tables and data sheets.
NameTechnical name for templates (prefix cf_, taxonomies ct_). Invalid characters are cleaned up automatically; if you leave it empty, a number is used. Do not change it once products have values.
Type / FormatSee the tables above.
Dropdown valuesAllowed values of a Dropdown field, one per line.
DescriptionShown as a tooltip next to the field name in the comparison table.
Prefix / SuffixText before or after the value, separated by a space. A field "Height" with suffix "cm" and value 100 shows "100 cm".
Show at datasheet / detaillist / comparetable / mobile comparetableDecides in which automatic outputs the field appears: the data sheet template, the detail list, the comparison table and its mobile version.
Move up / Move downOrder of the fields inside the group.

Field group information

SettingMeaning
NameGroup heading shown with the fields in the product and in grouped comparison tables.
Sort orderOrder of the groups when a product has fields from several groups.
DescriptionInternal note.

Enter values on the product

Open a product and switch to the Custom Fields tab. It shows the global fields and the fields of every field group that matches the product's category. Assign the product category first, save, and the group fields appear.

The Custom Fields tab of a product with the global fields Warranty, Weight and Test verdict
Field values are entered in the product.

Global fields and custom taxonomies also appear in the product import form and in the bulk import, so you can fill them while importing. HTML fields and taxonomy fields of field groups are not offered there.

Import fields and values from a table

Typing dozens of technical details is slow. Both the field group and the product have an Import data box for this. Paste one of the following and save:

  • the URL of a product page on billiger.de (starting with https://www.billiger.de/); the data sheet of that page is read,
  • the HTML of a data sheet list (<ul class="datasheet-list">),
  • or plain rows "name, tab, value", as you get them when you copy a two-column table from a web page. Without a tab, the first word is the name.

In the field group this creates one field per row that does not exist yet, with all four "Show at" options enabled. In the product (box "Import tools" in the sidebar) the values are written into the matching fields of its field groups. The match is made by the field name, so import the same table into the group first and then into the products.

Pump pressure	15 bar
Water tank	1.8 l
Milk frother	Yes

For fields with the format "number", the import keeps only the digits. "1.8 l" becomes 18, so check decimal values after the import.

Show the fields on your site

There are three ways to output custom fields:

  • Automatic: the data sheet and detail list templates and the comparison table show every field that has the matching "Show at" option.
  • Comparison table rows: put <!-AUTOROW-> into a row of a comparison table template. At that point all fields of the field groups are inserted automatically.
  • Own templates: in Blade templates use {!! $formatter->get_displayfield($product, 'cf_pressure') !!}, in comparison tables and old templates the placeholder %cf_pressure%. Prefixes: customfield_ (global field), cf_ (field group), customtaxonomy_ (custom taxonomy), ct_ (taxonomy field of a field group).
Comparison table of four coffee machines with highlight labels, images, prices, the custom field rows of the field group and buy buttons
The field group fills the rows of the comparison table.

Troubleshooting

  • The group fields do not appear in the product: check that the product has the product category the group is assigned to, and save the product once.
  • A field is empty in the output: check the name and prefix in the template (cf_ for field groups, customfield_ for global fields). Renamed fields lose their stored values.
  • A field is missing in the comparison table: enable "Show at comparetable" (and "Show at mobile comparetable" for phones).