# Problem mit leeren SELECT Zusatz Feld in Shopware 6

**URL:** https://forum.shopware.com/t/problem-mit-leeren-select-zusatz-feld-in-shopware-6/100847
**Category:** Programmierung
**Tags:** general, programming, templates--design
**Created:** [14. August 2023 um 00:12 UTC](https://forum.shopware.com/t/problem-mit-leeren-select-zusatz-feld-in-shopware-6/100847 "2023-08-14T00:12:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![husseinahk92](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/husseinahk92/32/21524_2.png) [@husseinahk92](https://forum.shopware.com/u/husseinahk92)
#### Post date: [14. August 2023 um 00:12 UTC](https://forum.shopware.com/t/problem-mit-leeren-select-zusatz-feld-in-shopware-6/100847/1 "2023-08-14T00:12:44Z")

</div>

Ich habe ein Problem bei der Erstellung eines benutzerdefinierten Select-Feldes in Shopware 6 mithilfe eines Plugins. Das benutzerdefinierte Feld wird erfolgreich erstellt, aber wenn ich versuche, das Select-Feld in den Kategorieeinstellungen zu verwenden, sind die Dropdown-Optionen leer. Statt der erwarteten „AN“ und „AUS“ Optionen zeigt das Dropdown zwei leere Werte an.

```auto
<?php declare(strict_types=1);

namespace MyNameSpace;

use Shopware\Core\Framework\Plugin\Context\ActivateContext;
use Shopware\Core\Framework\Context;
use Shopware\Core\Framework\Plugin;
use Shopware\Core\System\CustomField\CustomFieldTypes;
use Shopware\Core\Defaults;
use Shopware\Core\Framework\DataAbstractionLayer\EntityRepositoryInterface;
use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;

class MyClass extends Plugin
{
    public function activate(ActivateContext $activateContext): void
    {
        parent::activate($activateContext);
        
        $context = $activateContext->getContext();
        $this->createCustomField($context);
    }

    private function createCustomField(Context $context): void
    {
        $customFieldRepository = $this->container->get('custom_field_set.repository');

        $customFieldData = [
            'name' => 'categoryNoteSet',
            'config' => [
                'label' => [
                    'en-GB' => 'Categories Notes',
                    'de-DE' => 'Kategorien Hinweise',
                    Defaults::LANGUAGE_SYSTEM => "Categories Notes"
                ]
            ],
            'relations' => [
                [
                   'entityName' => 'category'
                ]
            ],
            'customFields' => [
                // ... Andere benutzerdefinierte Felder
                [
                    'name' => 'noteOfferActivate',
                    'type' => CustomFieldTypes::SELECT,
                    'config' => [
                        'label' => [
                            'en-GB' => 'Activate Offer note',
                            'de-DE' => 'Angebot Hinweis aktivieren',
                            Defaults::LANGUAGE_SYSTEM => "Note Text"
                        ],
                        'options' => [
                            [
                                'label' => [
                                    'en-GB' => 'ON',
                                    'de-DE' => 'An',
                                ],
                                'value' => 'true',
                            ],
                            [
                                'label' => [
                                    'en-GB' => 'OFF',
                                    'de-DE' => 'Aus',
                                ],
                                'value' => 'false',
                            ]               
                        ],
                        'customFieldPosition' => 5
                    ]
                ],
                // ... Andere benutzerdefinierte Felder
            ]
        ];

        $customFieldRepository->create([$customFieldData], $context);
    }
}

```

So so siehts aus :

 ![Screenshot 2023-08-14 021221](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/c/b/cbfe9a25c6c99ec7a133a6b8c40be2e50bc155fd.png)

**Details zum Problem:**

- Ich erstelle ein benutzerdefiniertes Select-Feld in Shopware 6 mithilfe des bereitgestellten Codes.
- Das benutzerdefinierte Feld wird erfolgreich mit zwei Optionen erstellt: „AN“ und „AUS“.
- Wenn ich jedoch auf die Kategorieeinstellungen zugreife, zeigt das Dropdown-Feld für das Select-Feld zwei leere Werte anstatt der erwarteten „AN“ und „AUS“ Optionen.

Ich freue mich über jede Hilfe oder Anleitung, wie dieses Problem gelöst werden kann. Vielen Dank für Ihre Unterstützung!
