RelatedCategory
This Output Kind outputs the Category (or the Categories) which a product is in. In order for that to work, you would need to tell EC about where it can find categories and what their KeyField is. We can create the following two mappings:
NOTE: these are mappings on Entity Category and not Product. We use .id to use the unique Perfion ID as key for categories and that we put that in a KeyField named CatId.
Now we can do a RelatedCategory mapping on Product as shown in Summary table below:
RelatedCategory |
| ||
What can be output | Supports | Supported Entities | |
a Features* r Attributes r Literals
*Only feature that can be used is the base-feature for Entity Category. You can only do one RelatedCategory-Mapping per Channel. | a Multi value features a Localizable features r Output Kind Parameters | r Site r Category a Product r Variant | |
Sample Mappings | |||
| |||
Sample output | |||
<Product id="636" ecommerceproduct="983ST">
…
<RelatedCategories>
<RelatedCategory name="Category" perfionname="My Website">
<Field name="CatId" relatedorder="7">2127</Field>
</RelatedCategory>
</RelatedCategories>
</Product>
|
Table 1: Summary of output kind RelatedCategory.
Notice that EC uses the value of the KeyField, here CatId, to point to which categories it belongs in. Note further, that it is perfectly OK for a product to be in multiple categories or in no categories.
As can be seen from below, the yellow jug is indeed in a category with id 2127 (Called “Keeping warm” in English):
From version 4.7 of Perfion the relatedorder is also specified on the RelatedCategory-element as shown in Table 1. The value here denotes where in the order of all products in that category, in which this product appears. As can be seen in Table 1 there is currently a value of “7”. Note that this does not necessarily mean that the product “983ST” is on the absolute position 7 in the category “Keeping warm” (id 2127). Rather it means that it is after other products with a relatedorder that is below 7 and before those that are bigger than 7 for the category “Keeping warm”. In other words, it works just as “relatedorder” known from the Perfion API.
NOTE: Just as for the Perfion API, in order to have relatedorder output, it is necessary that the feature holding the categories (in the example that would be the feature Website) has the feature-property “Sortable Related Items” checked in the Feature Definition-dialog. This is shown in the screenshot below.