# XML/CSV Shopping Feed: Order of the product images URLs

**URL:** <https://forum.shopware.com/t/xml-csv-shopping-feed-order-of-the-product-images-urls/98382>\
**Category:** Shopware 6 (English)\
**Tags:** general, administration, programming\
**Created:** [6. Februar 2023 um 15:33 UTC](https://forum.shopware.com/t/xml-csv-shopping-feed-order-of-the-product-images-urls/98382 "2023-02-06T15:33:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![devdrop](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/devdrop/32/19753_2.png) [@devdrop](https://forum.shopware.com/u/devdrop)\
**Post date:** [6. Februar 2023 um 15:33 UTC](https://forum.shopware.com/t/xml-csv-shopping-feed-order-of-the-product-images-urls/98382/1 "2023-02-06T15:33:54Z")

</div>

We are in the process of importing our products into the german eBay-classifieds website, but the output of the product photos URLs are in the wrong order.  
With the standard defaults (from the documentation as well as the [billiger.de](http://billiger.de) template) this is unfortunately not possible, the order seems very arbitrary.  
Even with another approach I found here in the forum, the order is still messed up. Only the cover image is output correctly:

```auto
<title>{{ product.translated.name|escape }}</title>
<description>{{ product.translated.description|escape }}</description>

<g:image_link>{{ product.cover.media.url }}</g:image_link>

<g:image_link>
    {%- if product.media|length > 1 -%}
        "{%- for mediaAssociation in product.media|slice(0, 5) -%}
            {{ mediaAssociation.media.url }}
            {%- if not loop.last -%},{%- endif -%}
        {%- endfor -%}"
    {%- endif -%}
</g:image_link>

<additional_image_link>
    {% for img in product.media.elements %}
        {{ img.media.url }},
    {% endfor %}
</additional_image_link>

<g:condition>new</g:condition>
<g:availability>in_stock</g:availability>

```

For your information: We import the products via Connector Plugin from Plentymarkets into SW6 and have no problems with the order of the images whatsoever. In the shop itself, everything is displayed in the correct way and the cover images are assigned accordingly. Only the export feed from Shopware does not correspond to the order of the images.

What could be the reason for this?

---

<div class="post-metadata">

**Author:** ![MarkusFischer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/markusfischer/32/13693_2.png) [@MarkusFischer](https://forum.shopware.com/u/MarkusFischer)\
**Post date:** [8. Februar 2023 um 08:17 UTC](https://forum.shopware.com/t/xml-csv-shopping-feed-order-of-the-product-images-urls/98382/2 "2023-02-08T08:17:09Z")

</div>

Doubled by [https://forum.shopware.com/t/xml-csv-shopping-feed-reihenfolge-der-produktbilder/98381/2](https://forum.shopware.com/t/xml-csv-shopping-feed-reihenfolge-der-produktbilder/98381/2) (German Forum)

Hello devdrop,  
I don’t have a direct solution for this. However, you can create your own solution for many things with TWIG.

The For loop only runs through the additional images from beginning to end in the standard order. To be honest, the question of a special sorting has not come up for me so far, but maybe you can solve it in a similar way as in this stackoverflow link: [https://stackoverflow.com/questions/25194470/twig-sort-array-of-objects-by-field](https://forum.shopware.com/t/xml-csv-shopping-feed-reihenfolge-der-produktbilder/98381/2). The Position field in the product\_media table could be used for this.

Best regards  
Markus
