Import/Export for Recommendations

Recommendations are imported as part of the catalog that owns them. A recommendation is represented as a top-level element of the catalog schema. The recommendation element is a sibling of the <product>, <category> and <category-assignment> elements.

Note: The following snippets are for illustration only. See the schema files for more details.

Schema File (Catalog.xsd)

The following snippet is from the catalog schema:

<!-- Recommendation -->
<xsd:complexType name="complexType.Recommendation" mixed="false">
    <xsd:sequence>
        <xsd:element name="display-name" type="sharedType.LocalizedString" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element name="short-description" type="sharedType.LocalizedString" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element name="long-description" type="sharedType.LocalizedString" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element name="callout-message" type="sharedType.LocalizedString" minOccurs="0" maxOccurs="unbounded" />
        <xsd:element name="image" type="simpleType.Generic.String.256" minOccurs="0" maxOccurs="1" />
        <xsd:element name="custom-attributes" type="sharedType.CustomAttributes" minOccurs="0" maxOccurs="1" />
    </xsd:sequence>

Example

The following is the part of the catalog schema file that handles RecommendationTypes:

<xsd:simpleType name="simpleType.RecommendationType">
  <xsd:annotation>
    <xsd:documentation>Allowed string values are the 'int' values defined for the Recommendation.recommendationType attribute, and additionally the values 'cross-sell', 'up-sell', and 'other' for backward compatibility.</xsd:documentation>
  </xsd:annotation>
  <xsd:restriction base="simpleType.Generic.String" />
</xsd:simpleType>

With RecommendationTypes, the system expects a positive integer value to be passed in this field (or one of the legacy values cross-sell, up-sell or other, which are internally converted to one, two, or three respectively). If anything else is passed, the import process reports an error and doesn't import the recommendation. The system doesn't validate the passed integer; if the value passed isn't equal to one of the configured attribute values, the system creates the recommendation with the passed type anyway.

You can define a list of RecommendationTypes in the Business Manager. For example, you can define a new type 4=="down-sell" or 5=="upside down sell", which appear in the XML file, as shown in the following sample:

<recommendation type="4" target-id="PN0002" source-type="product" source-id="PN0001" />
<recommendation type="5" target-id="S1965524" source-type="product" source-id="S1937231"/>

Sorting

Recommendations are sorted in the context of the source object and type. This sorting is accomplished in the Business Manager and as part of the catalog import process.

The import process positions recommendations in the same order as they appear in the catalog import file. An imported recommendation is: