Making product data available as XML

  • Updated

An HTTP request is used to load product data from your web space or server to the Template Kit and start the import into Optimizely Campaign.

When the request is made, your product data must:

Your company's environment determines whether you import static or dynamic product data. Contact your system administrator to learn which implementation is in use.

Saving static product data as XML on the server

To save product data statically as XML files on your webspace or server, each product must be saved in an XML file. You cannot group multiple products into a single XML file. To save a product as an XML file, perform the following steps.

  1. Open a text editor, such as Notepad (Windows) or Textedit (macOS/OS X).
  2. Create a new document.

    Set your text document to use UTF-8 character encoding. If you use another encoding, the text may not be represented properly.

    1. Copy the following code into the document.
      Code sample
      <element><property name="id"><![CDATA[123456]]></property><property name="name"><![CDATA[Name]]></property><property name="category"><![CDATA[Category]]></property><property name="manufacturer"><![CDATA[Author/Artist/Manufacturer]]></property><property name="text"><![CDATA[Product description]]></property><property name="oldPrice"><![CDATA[<s>EUR 29.99</s>]]></property><property name="currentPrice"><![CDATA[<b>EUR 19.99 EUR</b>]]></property><property name="linkText"><![CDATA[Add to shopping cart]]></property><property name="linkUrl"><![CDATA[]]></property><property name="imageUrl"><![CDATA[]]></property></element>

The following steps guide you through customizing this code for your setup. Only product ID (in code, the property id) and product name (in code, the property name) are mandatory. Other values are optional. Delete any unused values.

Example: You do not want to specify product manufacturer, so delete the following line:

<property name="manufacturer"><![CDATA[Author/Artist/Manufacturer]]></property>

Alternatively, leave unneeded lines of code empty. For example, you want to enter the information later. If you do not want to specify the product manufacturer and want to leave the code in the document, the line looks like this:

<property name="manufacturer"><![CDATA[]]></property>

You can use HTML source code in these properties: name, category, manufacturer, text, oldPrice, currentPrice. For example, you want to insert links into the product description.

  1. In the first property row, enter the product ID between the square brackets after CDATA.

    Example: The product ID is ParisTrip01.

    <property name="id"><![CDATA[ParisTrip01]]></property>

    Use only alphanumeric characters (letters and numbers) in the product ID. If you use special characters, you may encounter problems importing product data.

  2. In the second property line, enter the product name between square brackets after CDATA.
    <property name="name"><![CDATA[Unwind in Paris]]></property>
  3. In the third property line, enter the product category between square brackets after CDATA.
    <property name="category"><![CDATA[City travels]]></property>
  4. In the fourth property line, enter the product manufacturer (or, depending on product, author, artist, operator, manufacturer, and so on) between square brackets after CDATA.
    <property name="manufacturer"><![CDATA[Sun Worshipers Travel]]></property>
  5. In the fifth property line, enter the product description, for example text and a website link, between the square brackets after CDATA.
    <property name="text"><![CDATA[Eiffel Tower, Champs-Élysées, Louvre: Treat yourself to some time out in Paris!”]]></property>
  6. In the sixth property line, enter the product 's old price between <s> and </s>.
    <property name="oldPrice"><![CDATA[<s>EUR 399</s>]]></property>

    The old price is crossed out by default. To omit the strike-through in your communications, delete <s> and </s>.

  7. In the seventh property line, enter your product's current price between <b> and </b>.
    <property name="currentPrice"><![CDATA[<b>EUR 299</b>]]></property>

    By default, the current price is displayed in bold. To omit the bold, delete <b> and </b>.

  8. In the eighth property line, enter a text label for a product link between the square brackets after CDATA.
    <property name="linkText"><![CDATA[Book now]]></property>
  9. In the ninth property line, enter the URL link to your product between the square brackets after CDATA.
    <property name="linkUrl"><![CDATA[]]></property>
  10. In the tenth property line, enter the URL to your product image between the square brackets after CDATA.
    <property name="imageUrl"><![CDATA[]]></property>
  11. Save the text document. For the file name, use the product ID (the value you inserted for the id property). For file type. use .xml.
  12. Delete the document's file extension. For example, if the document is named ParisTrip01.xml, rename the file as ParisTrip01.

    If you do not remove the file extension, your product data cannot be loaded.

  13. Save the document in your webspace or on your server in the directory that you communicated for the setup of the product paragraph with content interface.

    Do not change the location of the product description documents without consulting customer support. If you change directories without consulting customer support, you cannot load product data using the content interface.

    After saving these documents, you can access your product offer in the Template Kit. Follow the steps in Load and edit product data to upload your product offer into the Template Kit using the content interface.

Generating dynamic product data on the server

XML files are not prepared manually, but are loaded from a database when requested (by HTTP request) via the content interface and automatically generated as XML. If you want to generate dynamic product data, see your system administrator.