title: Magento getting specific category id from product
body: <p>I'm currently using the following snippet to get my category ID for each product.</p>
  
  <pre><code>$categoryIds = $_product-&gt;getCategoryIds();
  
  foreach($categoryIds as $categoryId) {
      $category = Mage::getModel('catalog/category')-&gt;load($categoryId);
      echo $category-&gt;getName();
      echo $category-&gt;getUrlPath();
   }
  </code></pre>
  
  <p>I have then been passing the result of that into a switch to identify the category name.</p>
  
  <p>My problem is that I have just added a sale category that some products will be put into, and the result of </p>
  
  <pre><code>echo $category-&gt;getName(); 
  </code></pre>
  
  <p>is the sale category and not the "actual" category it is in.</p>
  
  <p>Does anyone have suggestions for how to make it a) ignore the sale category, b) get next category id stored for the product?, c) make it work some other way.</p>
  
  <p>Any help would be greatly appreciated!</p>