You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopware 6:能否在应用清单中使用媒体字段作为自定义字段?

在Shopware 6应用清单中使用媒体字段作为自定义字段

可以在Shopware 6的应用清单中配置媒体类型的自定义字段,但你提供的示例写法有误,导致无法正常运行。

问题分析

你使用了<many-to-one>标签关联media实体,但Shopware 6中,媒体字段作为自定义字段时,需要使用专门的<media>标签,而非通用的<many-to-one>。

正确配置示例

<custom-field-set>
    ...
    <related-entities>
        <category/>
    </related-entities>
    <fields>
        <media name="vendorname-image" store-api-aware="true" on-delete="set-null">
            <position>2</position>
            <label>Image for megamenu</label>
            <label lang="de-DE">Bild für Megamenü</label>
        </media>
    </fields>
</custom-field-set>

关键说明

  • 使用<media>标签替代<many-to-one>,这是Shopware 6针对媒体类型自定义字段提供的专属配置标签
  • 保留store-api-aware、on-delete等属性,确保字段的API可用性和删除行为符合预期
  • 标签内的name、position、多语言label配置保持原有逻辑即可

内容的提问来源于stack exchange,提问作者areanet_gmbh_schmid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.27 06:42:06