Hey Leute,
so langsam habe ich das Gefühl, ich werde hier bekloppt. Die ganze Zeit hat die Einbindung eines Custom Fields in den Produktexport problemlos geklappt. Nach ein paar Änderungen im Feed und in der dynamischen Produktgruppe zum entsprechenden Feed, bekomme ich plötzlich einen Error betreffend des eingebundenen Freitextfelds.
Failed rendering string template using Twig: Failed rendering string template using Twig: Key „product_customfields_googlecategory“ does not exist as the array is empty in „964663b41a248fa89f3d067e9fee3fe6“ at line 17.
Hier nochmal die Einstellung des entsprechenden Custom Fields
Hat noch jemand dasselbe Problem?
Mein Shopware 6 ist aktuell auf Version 6.4.17.0.
Mir ist komplett schleierhaft, woher dieses Problem kommen könnte.
Ich musste eine kleine Anpassung im Core machen, siehe https://forum.shopware.com/t/google-shopping-feed-varianten-und-eigenschaften/70536/12, dabei handelt es sich um eine einzige Zeile…
Hier nochmal mein aktueller Code für die Feed Produktzeile
<item>
<g:id>{{ product.productNumber }}</g:id>
{% if product.parentId is not null %}
{% set variantInfo = '' %}
{% for option in product.options %}
{% set variantInfo = variantInfo ~ ', ' ~ option.group.name ~ ': ' ~ option.translated.name %}
{% endfor %}
<title>{{ product.translated.name|escape }}{{ variantInfo|u.truncate(150, '...')|escape }}</title>
{% else %}
<title>{{ product.translated.name|escape }}</title>
{% endif %}
<description>{{ product.translated.description|striptags|u.truncate(900, '...')|escape }}</description>
<g:google_product_category>
{{ product.translated.customFields.product_customfields_googlecategory }}
</g:google_product_category>
{%- if product.categories.count > 0 -%}
<g:product_type>{{ product.categories.first.getBreadCrumb|slice(1)|join(' > ')|raw|escape }}</g:product_type>
{%- endif -%}
<link>{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}</link>
{% if product.cover.media is defined %}
<g:image_link>{{ product.cover.media.url }}</g:image_link>
{% if product.media|length > 1 -%}
{% for media in product.media %}
<additional_image_link>{{ media.media.url }}</additional_image_link>
{% endfor %}
{% endif %}
{% endif %}
<g:condition>new</g:condition>
<g:availability>
{%- if product.availableStock >= product.minPurchase and product.deliveryTime -%}
in_stock
{%- elseif product.availableStock < product.minPurchase and product.deliveryTime and product.restockTime -%}
backorder
{%- else -%}
out_of_stock
{%- endif -%}
</g:availability>
{%- if product.availableStock < product.minPurchase and product.deliveryTime and product.restockTime -%}
<g:availability_date>
{% set restockDays = '+' ~ product.restockTime ~ ' days' %}
{{ ("now"|date_modify(restockDays)|date("Y-m-d\\Th:i+0100")) }}
</g:availability_date>
{% endif %}
{% 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>
{% if product.unit.shortCode is defined and product.unit.shortCode is not null %}
<g:unit_pricing_measure>{{ product.purchaseUnit }} {{ product.unit.shortCode }}</g:unit_pricing_measure>
{% endif %}
{% if product.unit.shortCode is defined and product.unit.shortCode is not null %}
<g:unit_pricing_base_measure>{{ product.referenceUnit}} {{ product.unit.shortCode }}</g:unit_pricing_base_measure>
{% endif %}
<g:brand>{{ product.manufacturer.translated.name|escape }}</g:brand>
<g:gtin>{{ product.ean }}</g:gtin>
<g:mpn>{{ product.manufacturerNumber }}</g:mpn>
<g:shipping>
<g:country>DE</g:country>
<g:service>Standard</g:service>
<g:price>0.00 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 0 %}
{% for tag in product.tagIds %}
{% if break == 0 %}
{% if (tag == '042fad9a99934c40b73134aa72a19479') or (tag == '0c1da5467c564439afacd80e14247970') %}
{% for tag in product.tagIds %}
{% if break == 0 %}
{% if (tag == '8ed3c0c4bf35483ebdae3082e23668a3') or (tag == 'c2e14510db5c4899aae8fa3895078f75') %}
<g:shipping>
<g:country>AT</g:country>
<g:service>Standard</g:service>
<g:price>90.00 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 1 %}
{% elseif (tag == 'b537bc67ca8d4e669721ab7ec3435db2') or (tag == '2ec73a621c3e409e9ff2f2af75c621d2') %}
{% if price.unitPrice > 49 %}
<g:shipping>
<g:country>AT</g:country>
<g:service>Standard</g:service>
<g:price>0.00 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 1 %}
{% else %}
<g:shipping>
<g:country>AT</g:country>
<g:service>Standard</g:service>
<g:price>20.00 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 1 %}
{% endif %}
{% elseif (tag == '64d04f3ec1b840499e0083c492c489ff') or (tag == 'f9506cfb59af4440862c1f3bec808b86') or (tag == 'b3b8c3ba9aab4fcf8e56fbe44082931e') or (tag == 'f138cbd1c3ea4f0b966f372a0f4d4ca9')%}
{% if price.unitPrice > 49 %}
<g:shipping>
<g:country>AT</g:country>
<g:service>Standard</g:service>
<g:price>0.00 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 1 %}
{% else %}
<g:shipping>
<g:country>AT</g:country>
<g:service>Standard</g:service>
<g:price>3.95 {{ context.currency.isoCode }}</g:price>
</g:shipping>
{% set break = 1 %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% elseif loop.last %}
<g:shopping_ads_excluded_country>AT</g:shopping_ads_excluded_country>
{% endif %}
{% endif %}
{% endfor %}
{% set break2 = 0 %}
{% for tag in product.tagIds %}
{% if break2 == 0 %}
{% if (tag == 'e7660d292353470d936e896f0bca08b2') or (tag == 'e9c37bd2c6bb428598a5cd523477be4b') %}
{% for tag in product.tagIds %}
{% if break2 == 0 %}
{% if (tag == '64d04f3ec1b840499e0083c492c489ff') or (tag == 'f9506cfb59af4440862c1f3bec808b86') or (tag == 'b3b8c3ba9aab4fcf8e56fbe44082931e') or (tag == 'f138cbd1c3ea4f0b966f372a0f4d4ca9') %}
<g:shipping>
<g:country>CH</g:country>
<g:service>Standard</g:service>
{% if price.unitPrice > 400 %}
<g:price>{{ price.unitPrice * 0.1 }} {{ context.currency.isoCode }}</g:price>
{% else %}
<g:price>25.00 {{ context.currency.isoCode }}</g:price>
{% endif %}
</g:shipping>
{% set break2 = 1 %}
{% elseif loop.last %}
<g:shopping_ads_excluded_country>CH</g:shopping_ads_excluded_country>
{% endif %}
{% endif %}
{% endfor %}
{% elseif loop.last %}
<g:shopping_ads_excluded_country>CH</g:shopping_ads_excluded_country>
{% endif %}
{% endif %}
{% endfor %}
</item>