Field

Field is the most common output kind. It can output all ECommerce from-values, which are literals, features and attributes.

Field

What can be output

Supports

Supported Entities

a Features

a Attributes

a Literals

a Multi value features

a Localizable features

a Output Kind Parameters

a Site

a Category

a Product

a Variant

Sample Mappings

 

 

Sample output

 

<Product id="636" ecommerceproduct="983ST">   <Fields>     <Field name="Item No">983ST</Field>     <Field name="Title" culture="en-US">Vacuum Jug EM77 Yellow</Field>     <Field name="Title" culture="de-DE">Vacuum Jug EM77 Yellow</Field>     <Field name="Description" culture="en-US">The vacuum jug with the unique rocker stopper was created by Erik Magnussen... </Field>     <Field name="Description" culture="de-DE">Die Isolierkanne mit dem einzigartigen Kippverschluss wurde 1977 von Erik Magnussen...</Field>     <Field name="Visible">1</Field>     <Field name="MultiValueColor">       <Value>Yellow</Value>       <Value>Black</Value>       <Value>Steel</Value>     </Field>     <Field name="MultiValueColorDashSeparated">Yellow-Black-Steel</Field>     <Field name="Unit">Liter</Field>   </Fields> </Product>

 

Table 1: Summary of output kind Field.

As can be seen from the above table, all fields are output as children of a Fields-Element. A few details are worth mentioning:

  1. KeyFields are output just like “normal” fields. Item No in Table 1 is an example of this. The ECommerce Mapping Value, as you would know from the Perfion API, means the base value of the Perfion Item in this case the base-value of a product. Later this section “KeyFields” will be more elaborately described.

  2. Note the culture-designation on fields Title and Description, and that these fields are output twice: Once for the en-US culture and once for the de-DE culture. EC does that for localizable features. In section on settings, you can see how you configure EC to output more than one language/culture. Fields that are not coming from a localizable feature will not have any culture designation.

  3. Notice the Field Visible. This field come from a literal defined as described in section about Ecommerce Mapping - Base Value.

  4. The Field MultiValueColor obviously maps from a multi value feature in Perfion and you can see how each value is output in its own Value-element.

  5. The Field MultiValueColorDashSeparated maps from the same multi value feature (named MultiValueColor) in Perfion, but uses an expression to modify how its values are output. The shown example outputs it as dash-separated values, i.e. as “Yellow-Black-Steel”.

  6. The field Unit maps the “unit” attribute from the feature VolumeL using the “:” sign. See the Perfion API documentation for the full list of attributes available. This is not not be confused with decorating fields with attributes.

NOTE: Features that are both localizable and multi value are supported as well (but not shown in the example in Table 1). 

How the FormatMultiValue expression works

Expressions must be written as follows:

@FormatMultiValues(<BeforeValue>{Value}<AfterValue>|<BetweenValue>)

{Value} simply outputs the feature value. Instead of <BeforeValue> you write the string you want to appear before each value. Similarly with <AfterValue>. Finally after the | (pipe) you write the <BetweenValue>, which is string you want to appear between a pair of values.

The tables Table 2 and Table 3 each shows an example:

Dash-separated values

 

Expression

 

 

@FormatMultiValues({Value}|-)

 

Result

 

 

Yellow-Black-Steel

Table 2: Outputting a multi value feature as dash-separated values.

In Table 2 we have no Before- nor After-values. We just have a - (dash) as Between-value, meaning that this single character is put between all values as can be seen in the result.

Html unordered list

 

Expression

 

@FormatMultiValues(<li>{Value}</li>|)

 

 

 

 

Result

 

&lt;li&gt;Yellow&lt;/li&gt;&lt;li&gt;Black&lt;/li&gt;&lt;li&gt;Steel&lt;/li&gt;

 

Or written without the confusing Xml-encoding of lesser and greater than:

 

<li>Yellow</li><li>Black</li><li>Steel</li>

 

Table 3: Outputting a multi value feature as an unordered list as known from Html.

In Table 3 where we want to output an unordered list as in Html, the <BeforeValue> is “<li>”, the <AfterValue> is </li> and finally the <BetweenValue> is be blank (simply by having nothing after the pipe). It is important to have the pipe also in this case, since default <BetweenValue> is a semicolon.

You may create as many mappings as you want using expressions, and the expressions may be used on the same feature or on different features. Note, though, that you need pick a unique “To”-name in order to create a new Field for each.