# Plugin Konfiguration: Formular Store für Select-Feld

**URL:** <https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753>\
**Category:** Programmierung\
**Created:** [14. März 2018 um 10:16 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753 "2018-03-14T10:16:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![iNono](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@iNono](https://forum.shopware.com/u/iNono)\
**Post date:** [14. März 2018 um 10:16 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/1 "2018-03-14T10:16:27Z")

</div>

Hallo zusammen!

Ich möchte in meiner Plugin-Konfiguration ein Select-Feld zum Auswählen eines Formulars anzeigen. Dafür habe ich folgendes Element angelegt:

```
    ...
    ...
    Shopware.store.Form

```

Also habe ich sowohl die Kurzform „Shopware.store.Form“, als auch die Langform „Shopware.apps.Base.store.Form“ ausprobiert. Beim Öffnen der Konfiguration kommt keine Fehlermeldung, allerdings werden keine Optionen in das Select-Feld geladen. Also wenn ich auf das Select-Feld klicke, ist dort nichts, was ich auswählen kann. Formulare existieren aber auf jeden Fall. Kann mir jemand sagen, woran das liegt? Ist der Store nicht richtig?

---

<div class="post-metadata">

**Author:** ![MrMDeluxe](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@MrMDeluxe](https://forum.shopware.com/u/MrMDeluxe)\
**Post date:** [14. März 2018 um 15:19 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/2 "2018-03-14T15:19:00Z")

</div>

Hallo iNono,

&nbsp;

hier fehlt noch das value tag.

Versuch mal folgendes:

```
    ... 
    ... 
    Shopware.store.Form 

```

Dann solltest Du die Formulare im DropDown sehen.

Via options&nbsp;Tag&nbsp; kannst Du sogar noch das valueField und&nbsp;displayField setzen.

---

<div class="post-metadata">

**Author:** ![iNono](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@iNono](https://forum.shopware.com/u/iNono)\
**Post date:** [15. März 2018 um 10:21 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/3 "2018-03-15T10:21:44Z")

</div>

@MrMDeluxe‍ Danke für die Antwort, allerdings stimmt das nicht ganz. Ich habe es genau so versucht und dann kommt beim Plugin-Update folgender Fehler:

> Unable to parse file „/project/plugins-custom/MyPlugin/Resources/config.xml“. Message: [ERROR 1871] Element ‚value‘: This element is not expected. Expected is ( options ). (in /project/shopware/ - line 28, column 0)

Was ich jetzt noch gemacht habe ist, dass ich das „select“ durch „combo“ ersetzt habe, da das „select“ glaube ich nur für statische Werte ist und „combo“ für Stores. Also so entnehme ich das mal von [hier](https://developers.shopware.com/developers-guide/plugin-configuration/#selectionfield-/-remote-combobox). Es klappt aber leider immer noch nicht.

---

<div class="post-metadata">

**Author:** ![MrMDeluxe](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@MrMDeluxe](https://forum.shopware.com/u/MrMDeluxe)\
**Post date:** [15. März 2018 um 10:58 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/4 "2018-03-15T10:58:37Z")

</div>

Hier ist eine config.xml die ich aktuell benutze, um eine&nbsp;Kundengruppe&nbsp;via Plugin config auszuwählen:

```
            customergroup
            Kundengruppe
            
            
            Shopware.apps.Base.store.CustomerGroup
            
                false
                key
                name

```

Die funktioniert bei mir…

---

<div class="post-metadata">

**Author:** ![iNono](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@iNono](https://forum.shopware.com/u/iNono)\
**Post date:** [15. März 2018 um 12:10 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/5 "2018-03-15T12:10:22Z")

</div>

@MrMDeluxe‍ Ja mit einem anderen Store (article) klappt es bei mir ja auch. Nur nicht mit dem Store für die Formulare. Könntest du bei dir mal testen, ob es mit dem Form Store klappt?

---

<div class="post-metadata">

**Author:** ![MrMDeluxe](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@MrMDeluxe](https://forum.shopware.com/u/MrMDeluxe)\
**Post date:** [15. März 2018 um 14:06 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/6 "2018-03-15T14:06:52Z")

</div>

Mit dem Form Store klappt es auch.

Du hast aber den falschen Store genommen.

Nutze diesen hier, dann funktioniert es auch:

```
 Shopware.apps.Form.store.Form
```

---

<div class="post-metadata">

**Author:** ![iNono](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@iNono](https://forum.shopware.com/u/iNono)\
**Post date:** [15. März 2018 um 14:25 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/7 "2018-03-15T14:25:22Z")

</div>

Das hatte ich auch schon versucht. Da kommt dann bei mir dieser Fehler, wenn ich die Plugin-Konfiguration öffne:

![](http://www.bilder-upload.eu/upload/d5f267-1521123830.png)

Also so sieht jetzt mein Element aus:

```
    ...
    ...
    ...
    Shopware.apps.Form.store.Form
    
        false

```

Eine Idee, woran das liegen könnte?

---

<div class="post-metadata">

**Author:** ![MrMDeluxe](https://avatars.discourse-cdn.com/v4/letter/m/4da419/32.png) [@MrMDeluxe](https://forum.shopware.com/u/MrMDeluxe)\
**Post date:** [15. März 2018 um 15:08 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/8 "2018-03-15T15:08:28Z")

</div>

Ja.&nbsp;Der Form Store und das Form Model werden standardmäßig nicht mitgeladen.

(Ich hatte die Formulare noch im backend geöffnet, daher hat es bei mir funktioniert…)

Du musst Dich also auch noch darum kümmern.

In der Datei backend/base/bootstrap.js sind folgende Einträge nicht vorhanden:

```
 {include file='backend/form/model/form.js'}

 {include file='backend/form/store/form.js'}

```

Wenn Du die mal testweise hinzufügst, siehst Du&nbsp;das es dann funktioniert.

Um das ganze via Plugin zu machen, könntest Du&nbsp;

die Javascripts dann in folgendem Block:&nbsp;

```
 {block name="backend/base/header/javascript"} via append hinzufügen.
```

---

<div class="post-metadata">

**Author:** ![iNono](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@iNono](https://forum.shopware.com/u/iNono)\
**Post date:** [15. März 2018 um 15:47 UTC](https://forum.shopware.com/t/plugin-konfiguration-formular-store-fur-select-feld/51753/9 "2018-03-15T15:47:36Z")

</div>

Vielen Dank, das hat funktioniert!

Also habe im Plugin die bootsrap.js (Resources/views/backend/bootstrap.js) erweitert:

```
//{block name="backend/index/application" append}
{include file='backend/form/model/form.js'}
{include file='backend/form/store/form.js'}
//{/block}

```

Und dann in der plugin.php:

```
...
public static function getSubscribedEvents()
{
    return [
        'Enlight_Controller_Action_PostDispatchSecure_Backend_Index' => 'onIndexPostDispatch',
    ];
}

/**
 * Load ext components that override/extend global things
 *
 * @param \Enlight_Controller_ActionEventArgs $args
 */
public function onIndexPostDispatch(\Enlight_Controller_ActionEventArgs $args)
{
    $controller = $args->getSubject();
    $view = $controller->View();

    $view->addTemplateDir($this->getPath() . '/Resources/views/');
    $view->extendsTemplate('backend/bootstrap.js');
}

...

```

&nbsp;
