Multi Attribute Import

Importing Multiple Attributes In An Addtional XML Import

Regenerating and importing the main Tweakwise feed can take a lot of time, which can have a big impact on the duration of your entire update chain. That's why we introduced a way to update multiple attributes using one separate feed that can be loaded more frequently.

This extra import runs on top of your regular catalog sync. It is perfect for enriching products with rapidly changing data from secondary sources (like an ERP) without triggering a full sync. Common use cases for this frequent update include:

  • Pricing
  • Stock
  • Sales performance data

By grouping attributes within a single <item> node, you keep your feed clean and optimize the import process. We'll also cover how to handle multi-value attributes (like multiple sizes) and multi-language values.

Implementation

To import multiple attributes, you need to nest <attribute> tags within an <attributes> container inside your <item>.

Here is the exact XML structure you should use:

<?xml version="1.0" encoding="utf-8"?>
<items>
  <item>
    <id>1143</id>
    <attributes>
      <attribute>
        <name>performance-purchases-30days</name>
        <values>
          <value xml:lang="nl">100</value>
          <value xml:lang="en">90</value>
        </values>
      </attribute>
      <attribute>
        <name>sizes</name>
        <values>
          <value><![CDATA[XL]]></value>
          <value><![CDATA[L]]></value>
        </values>
      </attribute>
    </attributes>
  </item>
</items>

Breaking down the structure:

  1. <id>: The unique identifier for your item. This must match the ID in your main Tweakwise catalog.
  2. <name>: The identifier for the attribute (e.g., performance-purchase-30days, sizes).
  3. <value>: The actual value of the attribute.
  4. xml:lang (Optional): Use this attribute on the <value> tag to specify the language for multi-language setups.

Notes & Important Considerations

  • Attribute Existence: Make sure the attributes you want to import already exist in your Tweakwise instance. If they do not exist, you must create them before running the import.
  • Attribute Matching: This import only matches default attributes. Furthermore, the matching is strictly based on the attribute's name, not the UrlName.
  • Validation Rules & Error Handling: Keep the following data rules in mind to prevent import issues:
    • Whitespace & Empty Values: Values are automatically trimmed. Empty values are skipped entirely.
    • Length Limits: Values exceeding 400 characters are truncated (this will trigger a warning). Item IDs longer than 100 characters will result in a hard error.
    • Data Types: If an attribute is configured as numeric, non-numeric values will be skipped.
    • HTML Content: Any values containing HTML tags will be skipped.
    • Mixed Localization: If an attribute on a single item contains a mix of both localized (with xml:lang) and non-localized values, the non-localized values will be dropped and a warning is triggered.
  • Single Language Setups: If your webshop only uses one language, do not use the xml:lang attribute. Simply use <value>rood</value>.
  • Multi-value Attributes: As seen in the size attribute example above, providing multiple <value> tags without language declarations assigns an array of values to that single attribute (the item is available in both XL and L).
  • ID matching: the <id> tag can match a Tweakwise item id or any other attribute like EAN or SKU. If the identifier cannot be found during the import process, the attributes will be ignored.
  • Apply CDATA sections to all fields containing text with special characters. For example, image and url elements usually contain characters like &. Without CDATA those characters will be encoded, which in turn might result in some unwanted side-effects.

FAQ

Can I mix single-language and multi-language attributes in the same import?
Yes. You can use the xml:lang attribute only on the <value> tags that require translation. If an attribute (like a brand name) is universal, you can pass a single <value> tag without the language specification.

What happens if I accidentally include xml:lang in a single-language shop?
If you include an xml:lang with a language code that your Tweakwise instance doesn't recognize (which is typical for a single-language setup), the system will skip those values entirely and count them as a warning. Always omit xml:lang if you are running a single-language store.

Where do I use this XML feed?
Create an import task, make sure you choose Import multiple external attributes as type and run the import on your desired schedule.


Did this page help you?