name: Tweakwise
type: xml
logo: tweakwise.png
description: 'Tweakwise is a Holland company founded in 2012. It offers personalized site search, merchandising, and recommendations software solutions.'
guide_link: https://docs.tweakwise.com/docs/custom-feed
is_user_defined: 0
is_popular: 0
xml:
  schema: |
    <?xml version="1.0" encoding="utf-8"?>
    <tweakwise>
        <categories>
            <category>
                <categoryid>0</categoryid>
                <name>root</name>
                <rank>0</rank>
            </category>
            {% for category in context.categories %}
                <category>
                  <categoryid>{{ category.id }}</categoryid>
                  <name><![CDATA[{{ category.name }}]]></name>
                  <rank>1</rank>
                  <parents>
                      <categoryid>0</categoryid>
                  </parents>
                </category>
            {% endfor %}
        </categories>
        <items>
          {% for product in context.products %}
            <item>
              <id>{{ product.entity_id }}</id>
              <name><![CDATA[{{ product.name }}]]></name>
              <price>{{ product.final_price | price }}</price>
              <stock>{{ product.qty }}</stock>
              <brand><![CDATA[{{ product.manufacturer }}]]></brand>
              <image><![CDATA[{{ product.image }}]]></image>
              <url><![CDATA[{{ product.url }}]]></url>
              <groupcode>{{ product.parent.entity_id }}</groupcode>
              <categories>
                   <categoryid><![CDATA[{{ product.category.entity_id }}]]></categoryid>
              </categories>
              <attributes>
                 <attribute>
                   <name><![CDATA[Description]]></name>
                   <value><![CDATA[{{ product.description | stripHtml | plain }}]]></value>
                 </attribute>
                 <attribute>
                   <name><![CDATA[Sku]]></name>
                   <value><![CDATA[{{ product.sku }}]]></value>
                 </attribute>
                 {% if product.color %}
                 <attribute>
                   <name><![CDATA[Color]]></name>
                   <value><![CDATA[{{ product.color }}]]></value>
                 </attribute>
                 {% endif %}
                 {% if product.size %}
                 <attribute>
                   <name><![CDATA[Size]]></name>
                   <value><![CDATA[{{ product.size }}]]></value>
                 </attribute>
                 {% endif %}
              </attributes>
    		    </item>
          {% endfor %}
        </items>
    </tweakwise>
