title: Access one of several subcategories in Shopware Article view
body: <p>I want to execute some code if an Article is assigned to a certain subcategory. The articles in the shop each have several categories and subcategories.</p>
  
  <p>All this should happen in the template.</p>
  
  <p>When typing <em>{$sArticle.categoryID}</em> I get one of the assigned category ID's, but not all of them, since it isn't an array.</p>
  
  <p>I have used {debug} in the template to see if the targeted subcategory is present somewhere. It is not. Yet, in <em>s_articles_categories</em> the article is assigned to several categories, including the one I am looking for.</p>
  
  <p>This is the basic structure of <em>s_articles_categories</em>:</p>
  
  <pre><code>id | articleID | categoryID
  ----------———————————————--
  1  | 1         | 12
  2  | 1         | 22
  3  | 4         | 10
  4  | 4         | 22
  </code></pre>
  
  <p>Basically I want something like this:</p>
  
  <pre><code>{foreach $ARTICLE.CATEGORY.ID as $ID}
      {if $ID == [NUMBER]}
          {SOME_OUTPUT}
          {BREAK}
      {/if}
  {/foreach}
  </code></pre>
  
  <p>The example is using Pseudocode, since I am unsure how this actually should look like. </p>
  
  <p>It goes through all the correlations in <em>s_articles_categories</em> and if it finds a match, does something.</p>
  
  <p>How do I make this work?</p>