Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
{%- layout none -%}<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
    <channel>
        <title>{{shop.name | escape_once }} Squeezely Feed</title>
        <link>{{shop.url}}</link>
            {% assign cnt = 0 %}
            {% paginate collections.all.products by 50 %}
                 <nextpagelink>{{ paginate.next.url | prepend: shop.url }}</nextpagelink>
            {% for product in collections.all.products %}
                {% for variant in product.variants %}      
                  {% assign cnt = cnt | plus: 1 %}
                  <!-- Item #{{ cnt }} -->
                  <item>
                      <id>{{variant.sku}}</id>
                      <external_object_id>{{variant.id}}</external_object_id>
                      <condition>new</condition>
                      <description>{{ product.description | strip_html | strip_newlines | escape_once }}</description>
                    <link>{{shop.url}}{{variant.url}}</link>
                      <currency>{{shop.currency}}</currency>
                      <price>{{variant.price | divided_by:  100.00 }}</price>
                      <inventory>{{ variant.inventory_quantity }}</inventory>
                      <brand>{{product.vendor | escape_once }}</brand>
                      <parent_id>{{ product.id }}</parent_id>
                      {% if variant.title == 'Default Title' %}
                          <title>{{ product.title | strip_html | strip_newlines | escape_once }}</title>
                      {% else %}
                          <title>{{ product.title | strip_html | strip_newlines | escape_once }} {{ variant.title | strip_html | strip_newlines | escape_once }}</title>
                      {% endif %}
                      <image_links>
                        {% for image in product.images %}
                          <image_link>https:{{ image | image_url}}</image_link>
                        {% endfor %}
                      </image_links>
                      <category_ids>
                        {% for collection in product.collections %}
                            <category_id>{{ collection.id }}</category_id>
                        {% endfor %}
                      </category_ids>
                      <availability>{% if variant.inventory_quantity > 0 %}in stock{% else %}out of stock{% endif %}</availability>
                      {% if product.options_with_values.size > 0 -%}
                        {% for optionobj in product.options_with_values -%}
                          {% assign optionname = 'option' | append: optionobj.position %}
                          {% if optionobj.name == 'size' or optionobj.name == 'Size' %}
                            {% if variant[optionname] %}
                              <size>{{ variant[optionname] }}</size>
                            {% endif %}
                          {% endif %}
                          {% if optionobj.name == 'color' or optionobj.name == 'Color' %}
                            {% if variant[optionname] %}
                              <color>{{ variant[optionname] }}</color>
                            {% endif %}
                          {% endif %}
                        {%- endfor %}
                      {%- endif %}
                  </item>
                {% endfor %}
            {% endfor %}
            {% assign pagecount = paginate.current_page %}  
            {% endpaginate %}
            {% assign cnt = 0 %}
            {% if pagecount == 1 %}
             <categories>
              {% for collection in collections %}
                <category>
                  <id>{{ collection.id }}</id>
                  <title>{{ collection.title | strip_html | strip_newlines | escape_once  }}</title>
                  <description>{{ collection.description | strip_html | strip_newlines | escape_once }}</description>
                  <link>{{shop.url}}{{ collection.url }}</link>
                </category>              
              {% endfor %}
              </categories>
            {% endif %}
    </channel>
</rss>

...