# SearchBundle MediaListFacetResult

**URL:** <https://forum.shopware.com/t/searchbundle-medialistfacetresult/36194>\
**Category:** Programmierung\
**Created:** [21. April 2016 um 09:24 UTC](https://forum.shopware.com/t/searchbundle-medialistfacetresult/36194 "2016-04-21T09:24:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ABC9](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ABC9](https://forum.shopware.com/u/ABC9)\
**Post date:** [21. April 2016 um 09:24 UTC](https://forum.shopware.com/t/searchbundle-medialistfacetresult/36194/1 "2016-04-21T09:24:28Z")

</div>

Wie wende ich den&nbsp;MediaListFacetResult richtig an.

Ich möchte gerne einen Color&nbsp;Filter in der Storefront anzeigen lassen.

&nbsp; &nbsp; &nbsp; &nbsp; /\*  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\* Checks if the filter is active  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\*/  
&nbsp; &nbsp; &nbsp; &nbsp; if ($request-\>has(‚productAttributesForm‘)) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $params = $request-\>getParams();  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $searchParams = explode(’|’, $params[‚productAttributesForm‘]);

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $criteria-\>addCondition(  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new ProductAttributeCondition(  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‚attr1‘,  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProductAttributeCondition::OPERATOR\_IN,  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $searchParams  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );  
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; /\*\*  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\* adds the attributes facet  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\*/  
&nbsp; &nbsp; &nbsp; &nbsp; $criteria-\>addFacet(new ProductAttributeFacet(  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‚attr1‘, //attribute field  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProductAttributeFacet::MODE\_VALUE\_LIST\_RESULT, //filter facet  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‚productAttributesForm‘, //form name  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‚attributes‘ //filter label  
&nbsp; &nbsp; &nbsp; &nbsp; ));

---

<div class="post-metadata">

**Author:** ![ABC9](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ABC9](https://forum.shopware.com/u/ABC9)\
**Post date:** [21. April 2016 um 09:39 UTC](https://forum.shopware.com/t/searchbundle-medialistfacetresult/36194/2 "2016-04-21T09:39:19Z")

</div>

konnte leider keine beispiel implementierung finden :S

---

<div class="post-metadata">

**Author:** ![Oliver\_Skroblin](https://avatars.discourse-cdn.com/v4/letter/o/6bbea6/32.png) [@Oliver\_Skroblin](https://forum.shopware.com/u/Oliver_Skroblin)\
**Post date:** [22. April 2016 um 09:19 UTC](https://forum.shopware.com/t/searchbundle-medialistfacetresult/36194/3 "2016-04-22T09:19:12Z")

</div>

Hi,

die ProductAttributeFacet supported aktuell noch keine&nbsp;MediaListFacetResult. Dafür müsstest du dir aktuell eine eigene Implementierung als FacetHandler schreiben.

Ein entsprechendes Beispiel für eine eigene Facette und dessen Handler findest du hier:&nbsp;[SearchBundle](https://developers.shopware.com/developers-guide/shopware-5-search-bundle/#concept---extendable)

Wie genau ein&nbsp;MediaListFacetResult aufgebaut werden muss kannst du in den Klassen Parameter einsehen oder als Beispiel bei den Artikel Properties:

> <https://github.com/shopware/shopware/blob/5.1/engine/Shopware/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandler.php#L187>

Gruß Oliver

&nbsp;
