# Freitextfeld für Eigenschaften - Gruppe (s\_filter\_options\_attributes)

**URL:** <https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410>\
**Category:** Programmierung\
**Created:** [17. April 2018 um 08:27 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410 "2018-04-17T08:27:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![vierpunkt](https://avatars.discourse-cdn.com/v4/letter/v/ec9cab/32.png) [@vierpunkt](https://forum.shopware.com/u/vierpunkt)\
**Post date:** [17. April 2018 um 08:27 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/1 "2018-04-17T08:27:25Z")

</div>

Vorab als information was ich gern machen möchte. Ich benötige eine Klasse für die Filterblöcke die mir die unterschiedlichen Filter unterscheiden kann das ich unterschiedliche Anordnungen haben kann. Ich habe hierzu ein Freitextfeld **filter\_cat\_class** angelegt.

Nun habe ich das Problem das ich die Ausgabe im frontend nicht hinbekomme obwohl ein print\_r von $facet mir das richtige ausgibt

```
[attributes:protected] => Array
        (
            [core] => Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object
                (
                    [storage:protected] => Array
                        (
                            [id] => 1
                            [optionID] => 7
                            [filter_cat_class] => filter--big-images
                        )

                )

        )

```

allerdings ist dies dort protected. Ich wollte dann über die fuction $facet-\>getAttribute(‘filter\_cat\_class’) darauf zugreifen jedoch bekomme ich lediglich ein true zurück.

ich weis ehrlich gesagt nicht mehr weiter.

---

<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:15 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/2 "2018-04-17T14:15:53Z")

</div>

ich glaube es muss heißen: $facet-\>getAttribute(‚core‘)-\>get(‚filter\_cat\_class‘)

---

<div class="post-metadata">

**Author:** ![vierpunkt](https://avatars.discourse-cdn.com/v4/letter/v/ec9cab/32.png) [@vierpunkt](https://forum.shopware.com/u/vierpunkt)\
**Post date:** [18. April 2018 um 06:36 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/3 "2018-04-18T06:36:29Z")

</div>

Das wars vielen danke&nbsp; ![Thumb-Up](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/7fcda44f782696668a3d093569d15e88105769e1.png "Thumb-Up")

---

<div class="post-metadata">

**Author:** ![GerKuno](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@GerKuno](https://forum.shopware.com/u/GerKuno)\
**Post date:** [21. Juli 2018 um 15:40 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/4 "2018-07-21T15:40:08Z")

</div>

Habe ein ähnliches Problem.

Ich habe auch in Eigenschaften - Gruppe (s\_filter\_options\_attributes) ein Freitextfeld angelegt (Checkbox) welches ich dafür nutze ob die Gruppe überhaupt im Filter angezeigt werden soll oder nicht.

Wie komme ich an dieses Attribute im Template heran ?

So das ich z.b. in der frontend/listing/actions/action-filter-facets.tpl unterscheiden kann ob es gezeigt wird oder nicht. Die Standart Filter wie Preis , Lieferbar, Bewertungen etc. sollten auch gleich mit verschwinden.

Habe bereits hier im Forum gesucht, aber nichts hat zu einer Lösung geführt.

&nbsp;

---

<div class="post-metadata">

**Author:** ![lidax](https://avatars.discourse-cdn.com/v4/letter/l/53a042/32.png) [@lidax](https://forum.shopware.com/u/lidax)\
**Post date:** [3. September 2018 um 14:07 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/5 "2018-09-03T14:07:47Z")

</div>

Hallo,

ich hatte auch lange probiert, hat auch nicht funktioniert. Lösung war bei mir, zu testen, ob getAttribute Nullwert zurückliefert. Hier der Code:

{block name=“frontend\_listing\_actions”}  
&nbsp; &nbsp; {foreach $facets as $facet}&nbsp;&nbsp; &nbsp;  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{if $facet-\>getAttribute(‘core’) !== null}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{if $facet-\>getAttribute(‘core’)-\>get(‘Freitextfeld’) == 0}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{block name=“frontend\_listing\_actions\_facet”}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{if $facet-\>getTemplate() !== null}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{include file=$facet-\>getTemplate() facet=$facet}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/if}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/block}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/if}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{else}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{block name=“frontend\_listing\_actions\_facet”}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{if $facet-\>getTemplate() !== null}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{include file=$facet-\>getTemplate() facet=$facet}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/if}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/block}  
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;{/if}  
&nbsp; &nbsp; {/foreach}  
{/block}

---

<div class="post-metadata">

**Author:** ![Arya\_Svitkona](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/arya_svitkona/32/15319_2.png) [@Arya\_Svitkona](https://forum.shopware.com/u/Arya_Svitkona)\
**Post date:** [7. Februar 2020 um 08:07 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/6 "2020-02-07T08:07:58Z")

</div>

Hallo Zusammen,

Ist zwar ein etwas älterer Thread, doch der Kontext scheint der gleiche zu sein, weshalb ich lieber diesen reanimiere.

Ich habe aus meiner Sicht&nbsp;die gleiche Ausgangslage wie “vierpunkt” und möchte ein Freitextfeld eines Filters ausgeben. Hier muss ich ev. darauf Hinweisen, dass es sich um ein Varianten Option Freitextfeld handelt (Hexwert hinterlegen pro Farbvariante).  
Gebe ich mit&nbsp;

```
{$option-\>getAttribute('core')|print\_r}

```

das Objekt mal im Frontend aus, erhalte ich folgendes:

```
Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object (
    [storage:protected] => Array
    (
        [id] => 1
        [optionID] => 43
        [colorvalue] => #000000
    )
)
1

```

In der Klasse “Attribute” gibt es auch eine Methode “get()” in welcher als Parameter ein String übergeben wird (in meinem Fall “colorvalue”), damit man den zugewiesenen Wert erhält. Da bekomme ich jedoch eine Fehlermeldung im Frontend mit der Meldung “Call to a member function get() on null”.  
Kann mir jemand sagen, was ich falsch mache?

---

<div class="post-metadata">

**Author:** ![Arya\_Svitkona](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/arya_svitkona/32/15319_2.png) [@Arya\_Svitkona](https://forum.shopware.com/u/Arya_Svitkona)\
**Post date:** [7. Februar 2020 um 08:09 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/7 "2020-02-07T08:09:05Z")

</div>

Hallo Zusammen,

Ist zwar ein etwas älterer Thread, doch der Kontext scheint der gleiche zu sein, weshalb ich lieber diesen reanimiere.

Ich habe aus meiner Sicht&nbsp;die gleiche Ausgangslage wie “vierpunkt” und möchte ein Freitextfeld eines Filters ausgeben. Hier muss ich ev. darauf Hinweisen, dass es sich um ein Varianten Option Freitextfeld handelt (Hexwert hinterlegen pro Farbvariante).  
Gebe ich mit&nbsp;

```
{$option-\>getAttribute('core')|print\_r}

```

das Objekt mal im Frontend aus, erhalte ich folgendes:

```
Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object (
    [storage:protected] => Array
    (
        [id] => 1
        [optionID] => 43
        [colorvalue] => #000000
    )
)
1

```

In der Klasse “Attribute” gibt es auch eine Methode “get()” in welcher als Parameter ein String übergeben wird (in meinem Fall “colorvalue”), damit man den zugewiesenen Wert erhält. Da bekomme ich jedoch eine Fehlermeldung im Frontend mit der Meldung “Call to a member function get() on null”.  
Kann mir jemand sagen, was ich falsch mache?  
Das ganze wird auf der folgenden Zeile ausgeführt (in meinem eigenen Theme natürlich):  
[https://github.com/shopware/shopware/blob/5.6/themes/Frontend/Bare/frontend/listing/filter/\_includes/filter-multi-selection.tpl#L80](https://github.com/shopware/shopware/blob/5.6/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-selection.tpl#L80)

---

<div class="post-metadata">

**Author:** ![Arya\_Svitkona](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/arya_svitkona/32/15319_2.png) [@Arya\_Svitkona](https://forum.shopware.com/u/Arya_Svitkona)\
**Post date:** [17. Februar 2020 um 19:42 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/8 "2020-02-17T19:42:19Z")

</div>

Kann hier jemand einen Hinweis geben?  
Es scheint mir als ob ich an einem Syntaxfehler scheitere, auch wenn ich 10 Tage später noch nicht darauf gekommen bin.

---

<div class="post-metadata">

**Author:** ![magnolia4](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@magnolia4](https://forum.shopware.com/u/magnolia4)\
**Post date:** [14. Juli 2020 um 14:02 UTC](https://forum.shopware.com/t/freitextfeld-fur-eigenschaften-gruppe-s-filter-options-attributes/52410/9 "2020-07-14T14:02:28Z")

</div>

Hat sich hier etwas geändert - wir kommen ebenfalls nicht an unser Attribut „\_ **attr\_collapsed** \_“ ran, das an der Filter-Gruppe hängt:

```
        {foreach $facets as $facet}
            {if $facet->getAttribute('core') !== null}
                {if $facet->getAttribute('core')->get('attr_collapsed')} != 0}
                    {$isActive = " is--active"}
                    {break}
                {/if}
            {/if}
        {/foreach}

```

Das steckt in der **_$facets_** :

```
Shopware\Bundle\SearchBundle\FacetResult\FacetResultGroup Object ( [facetResults:protected] => Array ( [0] => Shopware\Bundle\SearchBundle\FacetResult\MediaListFacetResult Object ( [facetName:protected] => property [active:protected] => [label:protected] => Motiv [fieldName:protected] => f [values:protected] => Array ( [0] => Shopware\Bundle\SearchBundle\FacetResult\MediaListItem Object ( [media:protected] => Shopware\Bundle\StoreFrontBundle\Struct\Media Object ( [id:protected] => 3684 [name:protected] => icon_filter_europe [description:protected] => [preview:protected] => [type:protected] => VECTOR [file:protected] => /media/vector/03/g0/20/icon_filter_europe.svg [extension:protected] => svg [thumbnails:protected] => Array ( ) [width:protected] => 511 [height:protected] => 511 [path:protected] => media/vector/icon_filter_europe.svg [attributes:protected] => Array ( ) ) [id:protected] => 138 [label:protected] => Welt & Europa [active:protected] => [attributes:protected] => Array ( ) ) [1] => Shopware\Bundle\SearchBundle\FacetResult\MediaListItem Object ( [media:protected] => [id:protected] => 139 [label:protected] => Länder [active:protected] => [attributes:protected] => Array ( ) ) [2] => Shopware\Bundle\SearchBundle\FacetResult\MediaListItem Object ( [media:protected] => [id:protected] => 140 [label:protected] => Dt. Bundesländer [active:protected] => [attributes:protected] => Array ( ) ) [3] => Shopware\Bundle\SearchBundle\FacetResult\MediaListItem Object ( [media:protected] => [id:protected] => 141 [label:protected] => Tiere [active:protected] => [attributes:protected] => Array ( ) ) [4] => Shopware\Bundle\SearchBundle\FacetResult\MediaListItem Object ( [media:protected] => [id:protected] => 142 [label:protected] => Symbole [active:protected] => [attributes:protected] => Array ( ) ) ) [template:protected] => frontend/listing/filter/facet-media-list.tpl [attributes:protected] => Array ( [core] => Shopware\Bundle\StoreFrontBundle\Struct\Attribute Object ( [storage:protected] => Array ( [id] => 1 [optionID] => 29 [attr_collapsed] => 1 ) ) ) ) ) [facetName:protected] => property [label:protected] => [template:protected] => frontend/listing/filter/facet-group.tpl [attributes:protected] => Array ( ) )

```

&nbsp;
