php 在Shopware 6中为自定义字段添加自定义实体类型

z2acfund  于 5个月前  发布在  PHP
关注(0)|答案(1)|浏览(86)

在Shopware 6.4.0.0中,可以添加基于实体的自定义字段。
实体类型列表有限:
x1c 0d1x的数据
是否可以轻松添加其他实体类型,例如可用产品属性的列表?

  • 编辑 *https:github.com/shopware/platform/blob/trunk/src/Administration/Resources/app/administration/src/module/sw-settings-custom-field/component/sw-custom-field-type-entity/index.js#L9
iecba09b

iecba09b1#

添加以下内容就足够了

{
                label: "Product Property Group",
                value: 'property_group'
            }

字符串
到选择
https://github.com/shopware/platform/blob/trunk/src/Administration/Resources/app/administration/src/module/sw-settings-custom-field/component/sw-custom-field-type-entity/index.js#L9
然后可以创建一个自定义字段,让我们选择产品属性。
接下来,我们必须使这种变化持久化。
参见https://developer.shopware.com/docs/guides/plugins/plugins/administration/customizing-components

Component.override('sw-custom-field-type-entity', {
    computed: {
    entityTypes() {
        const types = this.$super('entityTypes');

        types.push(
            {
                label: 'Product Property Group',
                value: 'property_group'
            }
        );

        return types;
    }
    }
});

相关问题