title: Magento - get specific category name from product id
body: <p>This is my code:</p>
  
  <pre><code>$product = Mage::getModel('catalog/product')-&gt;load($_item['product_id']);
  $cats = $product-&gt;getCategoryIds();
  
  foreach ($cats as $category_id) {
  $_cat = Mage::getModel('catalog/category')-&gt;load($category_id);
       if ($category_id == 3 || 4 || 5 || 6 || 7 || 8) {
            echo $_cat-&gt;getName();
       }
  }
  </code></pre>
  
  <p>I want to display only one specific category(cat) name:</p>
  
  <p>If the product (it is always just one which is displayed) is in a specific cat (the specific cat ids are: 3,4,5,6,7,8) it should display the cat name (but only the cat name of one of these ids).</p>
  
  <p>Every product is in only one of these cats but it has more cats (child cats and default cat).</p>
  
  <p>For Example: I have a product from cat 4. My code displays all cat names (default, cat 4 and the child cats), but i just want the name of cat 4. My if expression doesn't work. Has anybody an idea how to fix this?</p>