# pluginconfig dynamisches select/combo

**URL:** <https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301>\
**Category:** Shopware 3.5\
**Tags:** programming\
**Created:** [18. Oktober 2012 um 11:50 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301 "2012-10-18T11:50:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bui\_ak](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bui\_ak](https://forum.shopware.com/u/bui_ak)\
**Post date:** [18. Oktober 2012 um 11:50 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/1 "2012-10-18T11:50:37Z")

</div>

hallo, angenommen ich möchte in der plugin-konfiguration ein select anbieten, welches z.b. alle verfügbaren bestellstati liefert. [http://wiki.shopware.de/\_detail\_891.htm … F\_Combobox](http://wiki.shopware.de/%5C_detail%5C_891.html#Select%5C_.2F%5C_Combobox) wie kann ich das dynamisch machen? zumal ich, solange das plugin nicht aktiv ist, keinen eigenen controller habe. in s\_core\_config\_elements werden ja die options fest gespeichert. btw: das beispiel mit dem buttonhandler funktioniert nicht…

---

<div class="post-metadata">

**Author:** ![hbee](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hbee](https://forum.shopware.com/u/hbee)\
**Post date:** [18. Oktober 2012 um 12:43 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/2 "2012-10-18T12:43:01Z")

</div>

versuch’s mal so: ` $sql = "SELECT `id`, `description`, `group` FROM `s_core_states` ORDER BY `position`"; $states = Shopware()-\>Db()-\>query($sql); $clearedArray = array(); $statusArray = array(); foreach($states as $k=\>$v){ if($v['group'] == 'payment'){ $clearedArray[] = array($v['id'],$v['description']); }else{ $statusArray[] = array($v['id'],$v['description']); } } [...] $form-\>setElement('select', 'status', array( 'label' =\> 'Bestellstatus:', 'store' =\> $statusArray, 'required'=\>true, 'scope' =\> \Shopware\Models\Config\Element::SCOPE\_SHOP) ); $form-\>setElement('select', 'cleared', array( 'label' =\> 'Zahlungsstatus:', 'store' =\> $clearedArray, 'required'=\>true, 'scope' =\> \Shopware\Models\Config\Element::SCOPE\_SHOP) ); `

---

<div class="post-metadata">

**Author:** ![bui\_ak](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bui\_ak](https://forum.shopware.com/u/bui_ak)\
**Post date:** [18. Oktober 2012 um 17:28 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/3 "2012-10-18T17:28:20Z")

</div>

so in etwa mache ich es ja auch, aber dann sind die werte statisch an die plugin-konfiguration gebunden. was machst du, wenn du einen neuen status in s\_core\_states einfügst und diesen dann deinem plugin zuweisen möchtest? de- und wieder neuinstallation des plugins ist keine option.

---

<div class="post-metadata">

**Author:** ![hbee](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hbee](https://forum.shopware.com/u/hbee)\
**Post date:** [18. Oktober 2012 um 20:43 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/4 "2012-10-18T20:43:12Z")

</div>

ach so, verstehe. du willst es nach der installation dynamisch halten. Ich glaube das geht nur über einen eigenen Controller/View, der dann die Tabelle dynamisch ausließt. Vielleicht könntest du das ganze auch in die enable- und nicht in die install-Methode schreiben. dann brauchst du das Plugin nur einmal de- und dann wieder aktivieren. Weiß aber nicht ob das mit den Formularen funktioniert…

---

<div class="post-metadata">

**Author:** ![bui\_ak](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bui\_ak](https://forum.shopware.com/u/bui_ak)\
**Post date:** [18. Oktober 2012 um 23:22 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/5 "2012-10-18T23:22:06Z")

</div>

nee, alles unbefriedigend … und wie gesagt, bei erst-installation ist das plugin ja noch nicht aktiv und damit sind eigene contoller nicht möglich … im veyton (ich weiß … böser böser feind) gibt man dazu einfach in der installer.xml `<type>dropdown</type><url>status:order_status</url>` an.

---

<div class="post-metadata">

**Author:** ![slowmotion](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@slowmotion](https://forum.shopware.com/u/slowmotion)\
**Post date:** [20. Oktober 2015 um 16:53 UTC](https://forum.shopware.com/t/pluginconfig-dynamisches-select-combo/9301/6 "2015-10-20T16:53:51Z")

</div>

[quote=“bui\_ak”] angenommen ich möchte in der plugin-konfiguration ein select anbieten, welches z.b. alle verfügbaren bestellstati liefert. [/quote] Is zwar schon was älter, aber falls dennoch nochmal jemand die Bestellstati in seinem Modul/Plugin braucht: ` $form-\>setElement('select', 'paypalStatusId', array( 'label' =\> 'Zahlstatus nach der kompletter Zahlung', 'value' =\> 12, 'store' =\> 'base.PaymentStatus', 'displayField' =\> 'description', 'valueField' =\> 'id', 'scope' =\> \Shopware\Models\Config\Element::SCOPE\_SHOP )); ` (Quelle: engine/Shopware/Plugins/Default/Frontend/SwagPaymentPaypal/Bootstrap.php) Für das Problem mit der dynamischen Selectbox habe ich noch keine Lösung - aber sobald ich mehr weiß, lass ich es euch wissen.
