# Custom Fields mit multi-select Entity

**URL:** <https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391>\
**Category:** Programmierung\
**Created:** [20. April 2020 um 11:02 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391 "2020-04-20T11:02:58Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [20. April 2020 um 11:02 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/1 "2020-04-20T11:02:58Z")

</div>

Hallo!

In einem Plugin möchte ich ein custom Field anlegen, wo ich mehere Kategorien z.B. auswählen kann. Als single-select kein Problem:

```
[
    'id' => Uuid::randomHex(),
    'name' => 'custom_field_foobar_categories',
    'type' => CustomFieldTypes::JSON,
    'config' => [
        'label' => [
            'en-GB' => 'Categories',
            'de-DE' => 'Kategorien'
        ],
        'componentName' => "sw-entity-single-select",
        'entity' => 'category',
        'customFieldType' => CustomFieldTypes::JSON,
        'customFieldPosition' => 3
    ],
    'customFieldSet' => ['id' => $fieldSetId]
];

```

Hier kann ich im Adminpanel eine Kategorie auswählen und diese wird auch gespeichert.

Als multi-select funktioniert das leider nicht:

```
[
    'id' => Uuid::randomHex(),
    'name' => 'custom_field_foobar_categories',
    'type' => CustomFieldTypes::JSON,
    'config' => [
        'label' => [
            'en-GB' => 'Categories',
            'de-DE' => 'Kategorien'
        ],
        'componentName' => "sw-entity-multi-select",
        'entityCollection' => 'category',
        'customFieldType' => CustomFieldTypes::JSON,
        'customFieldPosition' => 3
    ],
    'customFieldSet' => ['id' => $fieldSetId]
];

```

Ist die Eigenschaft `'entityCollection' => 'category'` überhaupt richtig? Oder fehlt noch etwas anderes? Hab auch schon alle möglichen Kominationen mit `entity` und `entityCollection` ausprobiert.

&nbsp;

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [27. April 2020 um 06:24 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/2 "2020-04-27T06:24:41Z")

</div>

niemand?

---

<div class="post-metadata">

**Author:** ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)\
**Post date:** [28. April 2020 um 07:27 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/3 "2020-04-28T07:27:38Z")

</div>

Probier mal&nbsp;sw-entity-multi-id-select statt&nbsp;sw-entity-multi-select.

Viele Grüße  
[https://www.digitvision.de](https://www.digitvision.de)

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [28. April 2020 um 08:04 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/4 "2020-04-28T08:04:30Z")

</div>

leider nein 😕

---

<div class="post-metadata">

**Author:** ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)\
**Post date:** [28. April 2020 um 08:12 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/5 "2020-04-28T08:12:34Z")

</div>

Hast du Shopware 6.2? Mit Shopware 6.1 ist ein multi select noch nicht möglich.

Viele Grüße  
[https://www.digitvision.de](https://www.digitvision.de)

---

<div class="post-metadata">

**Author:** ![11shop](https://avatars.discourse-cdn.com/v4/letter/1/90ced4/32.png) [@11shop](https://forum.shopware.com/u/11shop)\
**Post date:** [30. April 2020 um 10:14 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/6 "2020-04-30T10:14:09Z")

</div>

Habt ihr eine Lösung für die Ausgabe von Labels bei&nbsp;Multi-Select Custom Field ??&nbsp;

Bei Selectfelder bekomme ich nur die&nbsp;Technischer Name und nicht die Übersetzungen.&nbsp;

[https://issues.shopware.com/issues/NEXT-6932](https://issues.shopware.com/issues/NEXT-6932)

---

<div class="post-metadata">

**Author:** ![ural](https://avatars.discourse-cdn.com/v4/letter/u/b5e925/32.png) [@ural](https://forum.shopware.com/u/ural)\
**Post date:** [4. August 2020 um 20:29 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/7 "2020-08-04T20:29:04Z")

</div>

Habt Ihr eine Lösung? Ich habe das gleiche Problem

---

<div class="post-metadata">

**Author:** ![systemmarketing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/systemmarketing/32/14444_2.png) [@systemmarketing](https://forum.shopware.com/u/systemmarketing)\
**Post date:** [15. April 2021 um 12:01 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/8 "2021-04-15T12:01:41Z")

</div>

Hier mal eine Lösung für alle, die über diesen Post stolpern.

```
'customFields' => [
                [
                    'name' => 'signal',
                    'type' => CustomFieldTypes::JSON,
                    'config' => [
                        'type' => 'select',
                        'label' => [
                            'de-DE' => 'Signalwort',
                            'en-GB' => 'Signal word',
                        ],
                        'componentName' => 'sw-multi-select',
                        'customFieldType' => 'select',
                        'customFieldPosition' => 0,
                        'entity' => 'products',
                        'options' => [
                            [
                                'value' => 'warning',
                                'label' => [
                                    'de-DE' => 'Achtung',
                                    'en-GB' => 'Warning',
                                ]
                            ],
                            [
                                'value' => 'danger',
                                'label' => [
                                    'de-DE' => 'Gefahr',
                                    'en-GB' => 'Danger',
                                ]
                            ],
                        ]
                    ]
                ]]
```

---

<div class="post-metadata">

**Author:** ![cci-woelfel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/cci-woelfel/32/24017_2.png) [@cci-woelfel](https://forum.shopware.com/u/cci-woelfel)\
**Post date:** [12. November 2024 um 21:08 UTC](https://forum.shopware.com/t/custom-fields-mit-multi-select-entity/66391/9 "2024-11-12T21:08:36Z")

</div>

Leider weiß ich noch nicht, wie ich es nutze, aber du kannst die Ausgabe in den Select-Items über :labelProperty defineieren, in diesem Fall siehst du „John Doe“.

```auto
<sw-entity-multi-select
                    :label="$tc('plugin.detail.deinLabel')"
                    :placeholder="$tc('plugin.detail.deinPlaceholder')"
                    :entity-collection="customers"
                    v-model:value="pluginEntity.customerCollection"
                    valueProperty="'id'"
                    :labelProperty="['firstName', 'lastName']" 
                />

```
