Integrating Product Comparison via XML
The URL of the XML interface follows the following format:
$stringEscapeUtils.escapeHtml($body)
Just as in the Search module, the parameter format=xml
tells FACT-Finder to return any information in XML format. You can provide the article numbers of the products selected for comparison using the parameter ids
. The individual numbers should be separated by a semicolon.
By default, FACT-Finder will return all of the data for each product. If you only require the product IDs and the attribute data and values, you can also include the parameter idsOnly=true
when calling the method, so that only this information is returned.
The generated XML corresponds to the format below and is divided into two main sections. The attributes
section contains information on the comparable attributes; the results
section contains the individual products. The structure of the results
section is more or less based on the structure of the Search results, and so is not explained in greater detail here. The attributes section contains an attribute tag for each comparable attribute, providing the name of the attribute (name value
), the name of the field in the search database where it is contained (sourceField
) and information on whether the values of the products differ in this attribute (hasDifferences
).
<ff xsi:noNamespaceSchemaLocation="schema/7.2/ffcompare.xsd">
<attributes>
<attribute name="Hersteller" hasDifferences="false" sourceField="manufacturers_name"/>
<attribute name="Modelljahr" hasDifferences="true" sourceField="products_model_year"/>
...
</attributes>
<results count="3">
<record nr="0" id="17959">
<field name="Modelljahr">2009</field>
<field name="Hersteller">Corratec</field>
...
</record>
...
</results>
</ff>