# GELÖST - {if Abfrage auch auf Subkategorien anwenden

**URL:** <https://forum.shopware.com/t/gelost-if-abfrage-auch-auf-subkategorien-anwenden/54327>\
**Category:** Programmierung\
**Created:** [29. Juli 2018 um 17:14 UTC](https://forum.shopware.com/t/gelost-if-abfrage-auch-auf-subkategorien-anwenden/54327 "2018-07-29T17:14:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rockymarkets](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@rockymarkets](https://forum.shopware.com/u/rockymarkets)\
**Post date:** [29. Juli 2018 um 17:14 UTC](https://forum.shopware.com/t/gelost-if-abfrage-auch-auf-subkategorien-anwenden/54327/1 "2018-07-29T17:14:15Z")

</div>

Hallo Zusammen :)&nbsp;

**Ich stehe vor folgendem Problem:** &nbsp;Im Listing einer bestimten Kategorie soll der Artikel Bestand mit einem Badge angezeigt werden.  
Alles funktioniert soweit auch gut.

**Die Anzeige&nbsp;wird aber nicht in den Subkategorien&nbsp;eingeblendet und das ist Wichtig**.

Ich habe schon alles mögliche an variablen&nbsp;ausprobiert und komme einfach&nbsp;nicht weiter.

Hat einer eine Idee wie ich die Subkategorien mit einbinden kann?

Folgenden&nbsp;Block hab ich&nbsp;eingefügt:  
Wenn Artikel in Kategorie und Bestand über 10 dann grünen Badge anzeigen!

{block name=‘frontend\_listing\_box\_article\_esd’}  
&nbsp; {$smarty.block.parent}  
&nbsp; &nbsp; {if $sCategoryCurrent == 803 && $sArticle.instock \>= 10}  
&nbsp; &nbsp; &nbsp;

{$sArticle.instock} Ticket/s verfügbar  
&nbsp; &nbsp;

&nbsp; {/if}  
{/block}

&nbsp;

**Das hatte ich als Lösungversuch mal ausprobiert: ohne erfolg ;(**

{if $sCategoryCurrent == 1 or $sCategoryCurrent == 2 or $sCategoryCurrent == 3&nbsp;&& $sArticle.instock \>= 10}

Grüße  
Serafina

* * *

**DIE LÖSUNG:**

Ich habe jetzt eine Lösung für das problem gefunden.

1. Ich habe ein Freitxtfeld angelegt und dann einen Block mit if Abfrage attr7 angelegt:

{block name=‘frontend\_listing\_box\_article\_esd’}  
&nbsp; &nbsp; {if $sArticle.attr7 == 1 && $sArticle.instock \>= 10}  
&nbsp; &nbsp; &nbsp;

{$sArticle.instock} von 16 Ticket/s verfügbar {$sArticle.attr6}  
&nbsp; &nbsp;

&nbsp; {/if}  
{/block}

Wenn der Artikel attr7 == true ist dann löst er den Banner aus und zwar egal in welcher Kategorie er sich befindet. Funktioniert. 🙂
