# Abfrage ob eine Property genau eine bestimmte Ausprägung hat

**URL:** <https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324>\
**Category:** Programmierung\
**Created:** [13. April 2023 um 17:34 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324 "2023-04-13T17:34:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hkn11](https://avatars.discourse-cdn.com/v4/letter/h/258eb7/32.png) [@hkn11](https://forum.shopware.com/u/hkn11)\
**Post date:** [13. April 2023 um 17:34 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324/1 "2023-04-13T17:34:10Z")

</div>

Hallo

ich versuche im Listing (im action Button) abzufragen, ob das Produkt eine bestimmte Eigenschaftsausprägung hat, um dann den buy button umzubennen.

Kongreter Soll Die Eigenschaftsgruppe „SET“ die Ausprägung „JA“ haben.

Irgendwie komme ich aber nicht recht weiter, mein Ansatz bisher:

{% for properties in product.properties %}  
{% if product.properties.group.name == „Set“ %}  
{% set setproperty = product.properties.name %}  
{% endif %}  
{% endfor %}

und dann in die If Abfrage…

---

<div class="post-metadata">

**Author:** ![chapter2](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@chapter2](https://forum.shopware.com/u/chapter2)\
**Post date:** [13. April 2023 um 17:47 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324/2 "2023-04-13T17:47:57Z")

</div>

Nah dran, versuch mal `group.translated.name`

Im Standard-Theme werden für die Properties `page.product.sortedProperties` verwendet.

---

<div class="post-metadata">

**Author:** ![hkn11](https://avatars.discourse-cdn.com/v4/letter/h/258eb7/32.png) [@hkn11](https://forum.shopware.com/u/hkn11)\
**Post date:** [13. April 2023 um 18:04 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324/3 "2023-04-13T18:04:29Z")

</div>

das klingt schonmal besser! Danke

Könnte ich dann per if abfragen ob setproperty == „Ja“ ?

---

<div class="post-metadata">

**Author:** ![chapter2](https://avatars.discourse-cdn.com/v4/letter/c/f4b2a3/32.png) [@chapter2](https://forum.shopware.com/u/chapter2)\
**Post date:** [13. April 2023 um 19:24 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324/4 "2023-04-13T19:24:44Z")

</div>

Eigentlich muss man nicht auf strings zurückgreifen, wenn lediglich der Wahrheitswert gebraucht wird.

Nutze doch beim `if` in der group-Schleife `{% set isSetProduct = true %}` und dann am Buy-Button:

```auto
{% if isSetProduct|default(false) %}
  ...neuer Buttontext...
{% else %}
  ...alter Buttontext..
{% endif %}

```

---

<div class="post-metadata">

**Author:** ![hkn11](https://avatars.discourse-cdn.com/v4/letter/h/258eb7/32.png) [@hkn11](https://forum.shopware.com/u/hkn11)\
**Post date:** [13. April 2023 um 19:30 UTC](https://forum.shopware.com/t/abfrage-ob-eine-property-genau-eine-bestimmte-auspraegung-hat/99324/5 "2023-04-13T19:30:13Z")

</div>

Die Eigenschaft ist manuel gesetzt, da es sich um ein Konfiguratorprodukt durch ein spezielles Plugin handelt. Aber ich sehe grade dass man im Listing gar nicht auf die Eigenschaften Arrays zurückgreifen kann sondern nur auf der Detailseite. (Die For Schleife ist immer leer).
