# single\_selection nicht Name sondern Description

**URL:** <https://forum.shopware.com/t/single-selection-nicht-name-sondern-description/52426>\
**Category:** Programmierung\
**Created:** [17. April 2018 um 13:30 UTC](https://forum.shopware.com/t/single-selection-nicht-name-sondern-description/52426 "2018-04-17T13:30:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leibnitz](https://avatars.discourse-cdn.com/v4/letter/l/a587f6/32.png) [@leibnitz](https://forum.shopware.com/u/leibnitz)\
**Post date:** [17. April 2018 um 13:30 UTC](https://forum.shopware.com/t/single-selection-nicht-name-sondern-description/52426/1 "2018-04-17T13:30:15Z")

</div>

Hallo,

bin gerade beim Versuch eines Plugins und hab nun eine kleine Frage:

```
$crudService = Shopware()->Container()->get('shopware_attribute.crud_service');
        $crudService->update(
            's_core_auth_attributes',
            'lbntz_order_state',
            'single_selection',
            [
                'label' => 'Order Status',
                'displayInBackend' => TRUE,
                'entity' => \Shopware\Models\Order\Status::class
            ]
        );
        Shopware()->Models()->regenerateAttributeProxies(['s_core_auth_attributes']);

```

Jetzt wird mir in dem Dropdown Feld vom Status immer der Name ausgeben, möchte allerdings die Description ausgeben.

Wie kann ich hier einen anderen Wert anzeigen lassen?

&nbsp;

Lg Leibnitz

---

<div class="post-metadata">

**Author:** ![arnebecker](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@arnebecker](https://forum.shopware.com/u/arnebecker)\
**Post date:** [17. April 2018 um 14:21 UTC](https://forum.shopware.com/t/single-selection-nicht-name-sondern-description/52426/2 "2018-04-17T14:21:47Z")

</div>

Du musst dir einen eigenen&nbsp;SwagAttribute.FieldHandler&nbsp;dafür schreiben:

[https://developers.shopware.com/developers-guide/attribute-system/#define-own-single-and-multi-selection](https://developers.shopware.com/developers-guide/attribute-system/#define-own-single-and-multi-selection)

Die Doku ist leider nicht so gut an der Stelle. Aber das Beispiel Plugin ist ganz gut:

[https://developers.shopware.com/exampleplugins/SwagAttribute.zip](https://developers.shopware.com/exampleplugins/SwagAttribute.zip)

Wenn du das nicht für alle Status Felder haben willst, kannst du deinen Spaltennamen so ähnlich wie hier abfragen:

```
// first line magic?!?
Ext.define('Shopware.attribute.GhHasScmProcessAutomationErrorFieldHandler', {
    extend: 'Shopware.attribute.BooleanFieldHandler',

    supports: function(attribute) {
        var me = this;
        var supports = me.callParent(arguments);

        return (supports && attribute.get('tableName') == 's_order_attributes' && attribute.get('columnName') == 'gh_has_scm_process_automation_error');
    },

    create: function(field, attribute) {
        var me = this;
        field = me.callParent(arguments);

        field.readOnly = true;
        return field;
    }
});

```

&nbsp;
