nagodinagodi MemberComments: 1 Received thanks: 0 Member since: December 2020

Hello!

The email templates, esp. order confirmation and updates, should contain thumbnails of the lineitems. The mediaId is saved in lineItem.coverId.

 

I have tried to solve it with the  searchMedia() function           

{# search for media in database #}
{% set media = searchMedia([lineItem.coverId], context.context) %}

{# extract mediaentity object #}
{% set mediaEntity = media.get(lineItem.coverId) %}

 {# get url #}
 {% set mediaUrl = mediaEntity.getUrl() %}
{{mediaUrl}}

=> official docu: https://docs.shopware.com/en/shopware-platform-dev-en/how-to/custom-fields-media-type
=> discussion: https://forum.shopware.com/discussion/65543/customfields-media-ausgabe

The problem seems to be that the context isn't existing in the mail templates. Also, there is an empty output when I am using {{ dump() }} ; although the environment is set to DEV mode

Do you have any ideas how to solve this?
How do you include the images? Or how do you get the image url?

Thanks!

Answers

  • kanumakanuma MemberComments: 288 Received thanks: 57 Member since: May 2014

    Any new regarding this issue?

Sign In or Register to comment.