# Shopware 6 Facebook Feed export

**URL:** <https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861>\
**Category:** Shopware 6 (German)\
**Created:** [7. April 2022 um 20:51 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861 "2022-04-07T20:51:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![boecker3d](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@boecker3d](https://forum.shopware.com/u/boecker3d)\
**Post date:** [7. April 2022 um 20:51 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861/1 "2022-04-07T20:51:44Z")

</div>

Hallo zusammen,  
ich bekomme den Facebook Feed Export nicht zum laufen.  
Hat jemand für mich eine funktionierende Kopfzeile und Template?  
Habe auch das Problem, das die Beschreibung immer im HTML übertragen wird, das mag Facebook leider nicht.

Viele Grüße  
Daniel

---

<div class="post-metadata">

**Author:** ![PromoID](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/promoid/32/14015_2.png) [@PromoID](https://forum.shopware.com/u/PromoID)\
**Post date:** [8. April 2022 um 11:44 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861/2 "2022-04-08T11:44:28Z")

</div>

Hi ^^ damit kann ich dir helfen.

Kopfzeile:

```auto
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <atom:link href="{{ productExport.salesChannelDomain.url }}/store-api/product-export/{{ productExport.accessKey }}/{{ productExport.fileName }}" rel="self" type="application/rss+xml" />
        <title>{{ context.salesChannel.name }}</title>
        <link>{{ productExport.salesChannelDomain.url }}</link>
        <language>{{ productExport.salesChannelDomain.language.locale.code }}</language>
        <image>
            <url></url>
            <title>{{ context.salesChannel.name }}</title>
            <link>{{ productExport.salesChannelDomain.url }}</link>
        </image>

```

Produktzeile:

```auto
<item>
    <g:id>{{ product.productNumber }}</g:id>
    <title>{{ product.translated.name|raw|length > 62 ? product.translated.name|raw|slice(0,062) ~ '...' : product.translated.name|raw }}</title>
    <description>{{product.description|striptags}}</description>
    <g:google_product_category>5457</g:google_product_category>
    <g:product_type>{{ product.categories.first.getBreadCrumb|slice(1)|join(' > ')|raw|escape }}</g:product_type>
    <link>{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}</link>
    <g:image_link>{{ product.cover.media.url }}</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>
    {% set price = product.calculatedPrice %}
    {%- if product.calculatedPrices.count > 0 -%}
        {% set price = product.calculatedPrices.last %}
    {%- endif -%}

    <g:price>{{ price.unitPrice|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>
    <g:brand>HIER BRAND EINGEBEN</g:brand>
    <g:gtin>{{ product.ean }}</g:gtin>
    <g:mpn>{{ product.manufacturerNumber }}</g:mpn>
</item>

```

Achte bitte noch auf Brand, da hatten wir manuell den Namen vom Shop eingetragen 🙂  
PS: google product category ist ebenfalls vorausgewählt - eine Liste findest du schnell über Google. Wir haben den einfach drin gelassen, funktioniert so auch einwandfrei 🙂

---

<div class="post-metadata">

**Author:** ![boecker3d](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@boecker3d](https://forum.shopware.com/u/boecker3d)\
**Post date:** [9. April 2022 um 17:27 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861/3 "2022-04-09T17:27:46Z")

</div>

Hi, danke für die Hilfe.

Jetzt funktioniert alles.

Viele Grüße  
Daniel

---

<div class="post-metadata">

**Author:** ![edelweiss](https://avatars.discourse-cdn.com/v4/letter/e/a88e4f/32.png) [@edelweiss](https://forum.shopware.com/u/edelweiss)\
**Post date:** [28. April 2022 um 10:33 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861/4 "2022-04-28T10:33:12Z")

</div>

Hi und danke für das Template. Das war sehr hilfreich.

Ich habe eine Frage. Da in unserem Produktkatalog das Titelbild ein Freistellerbild ist, wir für den Katalog und insbesondere die Dynamic Ads auf Facebook eher die Mood-Bilder nutzen wollen, soll die Ausgabe des Media-Links etwas modifziert werden. Grob soll für alle Produkte mit nur einem hinterlegten Bild das Cover-Bild ausgegeben werden, für alle anderen das zweite Bild (das i.d.R. ein Mood-Bild ist).

Ich habe auch schon etliche Varianten ausprobiert, aber die Ausgabe ist leider immer fehlerhaft.

\<g:image\_link\>  
{% if product.media|length \> 1 %}  
{% for mediaAssociation in product.media|slice(2, 1) %}  
{{ mediaAssociation.media.url }}  
{% endfor %}  
{% else %}  
{{ product.cover.media.url }}  
{% endif %}  
\</g:image\_link\>

Bei diesem Code bekomme ich für etliche Produkte überhaupt keinen Link ausgegeben, obwohl Bilder hinterlegt sind. Bei anderen Produkten erhalte ich den Bild-Link wie beabsichtigt. Einen Grund konnte ich aber noch nicht ausmachen.

Wenn jemand einen Tipp hat, wäre ich dankbar.

---

<div class="post-metadata">

**Author:** ![haustechnik](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@haustechnik](https://forum.shopware.com/u/haustechnik)\
**Post date:** [7. Dezember 2023 um 08:13 UTC](https://forum.shopware.com/t/shopware-6-facebook-feed-export/93861/5 "2023-12-07T08:13:01Z")

</div>

Hi edelweiss,

probier das hier mal - so funktioniert es zumindest bei uns:  
Hier wird genau das 2. Bild ausgegeben.

{% if product.media|length \> 1 %}{% for mediaAssociation in product.media|slice(2,1) %}{{ mediaAssociation.media.url }}{% endfor %}{% else %}{{ product.cover.media.url }}{% endif %}

Grüße
