Integrating ASN via XML Interface
When integrating via XML you must convert the search query parameters into a URL and receive the search result back in a defined XML format. The result is obtained by submitting a URL such as:
$stringEscapeUtils.escapeHtml($body)
When integrating via XML you must convert the search query parameters into a URL and receive the search result back in a defined XML format. The result is obtained by submitting a URL such as:
Result structure
The result structure contains two important sections:
The searchControlParams
block indicates whether After Search Navigation has been generated for the query.
<ff xsi:noNamespaceSchemaLocation="schema/7.2/ffresult.xsd">
...
<searchControlParams>
...
<useAsn>true</useAsn>
...
</searchControlParams>
...
</ff>
The asn
block contains the filter options that are available to allow the user to further refine the search results. The ASN contains groups (such as price, colour, category) and their filter elements (such as blue, red, yellow).
<ff xsi:noNamespaceSchemaLocation="schema/7.2/ffresult.xsd">
...
<asn>
<group name="Category" detailedLinks="7" type="text" style="TREE"
selectionType="singleHideUnselected">
<element field="Category0" name="DVD" count="0" clusterLevel="0" selected="true">
<searchParams>
url for selecting the filter
</searchParams>
</element>
<element field="Category1" name="Drama" count="25" clusterLevel="1" selected="false"
previewImage="ImageURL">
<searchParams>
url for selecting the filter
</searchParams>
</element>
...
</group>
<group name="Price" detailedLinks="5" unit="EUR" style="SLIDER" selectionType="singleHideUnselected">
<element field="BasePrice" name="Preis" count="0" clusterLevel="0" selected="false"
selectedMin="2" selectedMax="1599" absoluteMin="2" absoluteMax="1599">
<searchParams>
main url for the slider
</searchParams>
</element>
</group>
</asn>
...
</ff>
A group tag represents a filter group, for which the name attribute is the name of the group. The attribute detailedLinks
indicates how many links should be shown in detail. All others are normally shown in a Select box. The value can be defined using the Management Interface, so that the settings can easily be changed. If a unit is also defined for the group, the attribute unit is also present, the value of which should appear after each element name.
The type attribute determines how the values of the group should be treated. It can be one of the following: number (which means the values are numeric), multi (the values are multi-attributes), text (the values are text strings), categoryPath
(the values are in the form of a category path).
The default style of a group is DEFAULT. This means the group should be rendered as a normal list of items. However, it is possible to change it in the Management Interface to SLIDER, MULTISELECT or TREE.
If the group has been configured as TREE, it should be rendered as collapsible tree. In this case, the level on which a single group item should be rendered is described by the clusterLevel
attribute on element tag.
If the group has been configured as MULTISELECT, the group should be rendered similarly to the default representation, however allowing multiple selection of items. In this case the precise way of rendering multiple selection is described by the selectionType
attribute – values multiSelectOr
and multiSelectAnd
mean that multiple selection should be enabled (normally items should contain checkboxes which allow the selection of many elements at once).
The difference between them is in the way of handling selected elements – in case of multiSelectOr
the search result will contain products which belong to one of the selected groups, while in the case of multiSelectAnd
each result found must belong to all selected groups. The attribute selectionType
may also have the value singleShowUnselected or singleHideUnselected. This means the selection of multiple elements should be disabled. In case of singleShowUnselected
all groups which are not selected are still shown in the group (normally they would be rendered using radio-buttons), while in case of singleHideUnselected
the values which are not selected are not present in the group at all.
If the group has been configured as a slider group in the Management Interface, the attribute value of style in the group tag is SLIDER. The element in the group then has the additional attributes selectedMin
, selectedMax
, absoluteMin
and absoluteMax
. The values of the attributes refer to the minimum and maximum values that are displayed in the slider. If no group selection has been made, both the minimum and maximum values are identical. If a range has been selected, it is returned with selectedMin
and selectedMax
. The range in absoluteMin
and absoluteMax
specifies the maximum range of the slider, so that a wider range can be selected again under certain circumstances.
If you wish to use the slider to restrict a particular range, you will need to attach that range to the URL using searchParams
. The value is derived from the minimum and maximum values which are separated by a hyphen (such as: 5 - 23). The parameter names are derived from the prefix filter and the related field name. For example, a field with the name Price would result in the following parameter: …&filterPrice=5+-+23
.
Each possible filter element in the group is returned in an element tag. The attributes contain both the name (name) and the number of expected hits, if this is to be restricted (count).
singleHideUnselected
the value for count
is 0
by default and can be ignored.The clusterLevel
indicates the level at which the element is to be found. This can be used to indent categories, for example. The Boolean value selected indicates whether or not the element has been filtered. If the element has been selected, the URL to remove the filter is returned in searchParams
. FACT-Finder offers the option of displaying thumbnails for filter elements. If this feature is active, the preview URL for the filter is the value previewImage
.