如果产品属于父类别,请在Magento中执行某些操作

Right now I'm trying to find out if a product is in a specific parent category, if it is - it will display an image. Parent category 67 is the parent category, as shown below.

Home > 67 > 22 > 1

$category = Mage::getModel('catalog/layer')->getCurrentCategory();

And

<?php if (Mage::registry('current_category') && Mage::registry('current_category')->getId() == 67) { ?>
-show image-
<?php } ?>

So far it works only for products inside 67, but not products in the sub categories with 67 as its parent

There is a simple solution. You can get product parent category and if it is the desired category do what you want to do.

if ($product->getCategory()->getParentCategory() == 'your_desire_category'){
    //your code
}

Where $product can be retrieve by

$product = Mage::getModel('catalog/product')->load($product_id);