This is my code:
$product = Mage::getModel('catalog/product')->load($_item['product_id']);
$cats = $product->getCategoryIds();
foreach ($cats as $category_id) {
$_cat = Mage::getModel('catalog/category')->load($category_id);
if ($category_id == 3 || 4 || 5 || 6 || 7 || 8) {
echo $_cat->getName();
}
}
I want to display only one specific category(cat) name:
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).
Every product is in only one of these cats but it has more cats (child cats and default cat).
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?