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:
- exist on your web space or server as an XML file (static product data)
or
- be generated dynamically in an XML format (dynamic product data)
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.
- Open a text editor, such as Notepad (Windows) or Textedit (macOS/OS X).
- 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.
- 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[http://www.example.com/product/123456]]></property><property name="imageUrl"><![CDATA[http://img.example.com/product/123456.jpg]]></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.
- 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.
- In the second property line, enter the product name between square brackets after CDATA.
<property name="name"><![CDATA[Unwind in Paris]]></property>
- In the third property line, enter the product category between square brackets after CDATA.
<property name="category"><![CDATA[City travels]]></property>
- 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>
- 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>
- 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>
. - 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>
. - 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>
- In the ninth property line, enter the URL link to your product between the square brackets after CDATA.
<property name="linkUrl"><![CDATA[http://www.sonnenhungrig.com/paris]]></property>
- In the tenth property line, enter the URL to your product image between the square brackets after CDATA.
<property name="imageUrl"><![CDATA[http://www.sonnenhungrig.com/eiffeltower.jpg]]></property>
- 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.
- Delete the document's file extension. For example, if the document is named
ParisTrip01.xml
, rename the file asParisTrip01
.If you do not remove the file extension, your product data cannot be loaded.
- 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.
Please sign in to leave a comment.