I'm trying to include a graphic on all category pages except one specific category page and all of its children category pages too.
I am successfully excluding it from the main category 348, but I'd like to exclude from all of its children as well.
Here's the code I currently have:
<?php // Steps Graphic
if($level == 3 && $category_id != 348):
echo $this->getLayout()->createBlock('cms/block')->setBlockId('step1_graphic')->toHtml();
elseif ($level == 4 && $category_id != 348):
echo $this->getLayout()->createBlock('cms/block')->setBlockId('step2_graphic')->toHtml();
?>
Here are the entire script list.phtml that I'm working with:
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
?>
<?php
$_helper = Mage::helper('catalog/output');
$catalogx=Mage::getBlockSingleton('catalogx/category_subcategories');
$parentCollection =$catalogx->getCurrentChildCategories();
$count=$parentCollection->count();
?>
<?php if($count>0):?>
<?php $_columnCount = 4;
$product = Mage::getModel('catalog/product')->load(0);
$catThumbPlaceholder = Mage::helper('catalog/image')->init($product, 'image')->resize(99, 161); ?>
<div class="category-products subcategory-catview">
<?php $category_id= Mage::getModel('catalog/layer')->getCurrentCategory()->getId();
$rootCategoryId = Mage::app()->getStore()->getRootCategoryId();?>
<?php if($category_id!=$rootCategoryId): ?>
<?php $_category= Mage::getModel('catalog/category')->load($category_id);
$level=$_category->getLevel();
?>
<?php //echo Mage::getModel('catalog/layer')->getCurrentCategory()->getName(); ?>
<div class="page-title category-title">
<?php if($level==2): $buttontext='Select Type';?>
<h1><?php echo 'Select Door Type'; ?></h1>
<?php else: $buttontext='Select Style'; ?>
<h1><?php echo 'Select '.$_category->getName(); ?></h1>
<?php endif; ?>
</div>
<div class="category-short-description std">
<?php echo $_category->getShortDesciption();?>
<?php //echo $_helper->categoryAttribute($_category, $_short_description, 'short_description') ?>
<?php // Steps Graphic
if($level == 3 && $category_id != 348):
echo $this->getLayout()->createBlock('cms/block')->setBlockId('step1_graphic')->toHtml();
elseif ($level == 4 && $category_id != 348):
echo $this->getLayout()->createBlock('cms/block')->setBlockId('step2_graphic')->toHtml();
?>
<?php endif;?>
</div>
<?php endif; ?>
<?php $i=0; foreach ($parentCollection as $parent): ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid subcategory-list">
<?php endif;?>
<li class="item<?php if ($i == 1 || $i%4 == 1): ?> first<?php elseif ($i == $count): ?> last<?php endif; ?>">
<div class="category-entry">
<div class="pro-image">
<?php
if ($parent->getThumbnail()){
$parentThumb = Mage::helper('catalogx')->resizeImage($parent->getThumbnail(), 'catalog' . DS . 'category', 99, 161);
}else{
$parentThumb = $catThumbPlaceholder;
}
?>
<a href="<?php echo $parent->getUrl() ?>" title="<?php echo $parent->getName() ?>" class="product-image"><img src="<?php echo $parentThumb ?>" width="99" height="161" alt="<?php echo $parent->getName() ?>" /></a>
</div>
<div class="pro-text cat-text">
<?php $catname=$parent->getName(); ?>
<h2 class="product-name"><a href="<?php echo $parent->getUrl() ?>" title="<?php echo $parent->getName() ?>">
<?php echo $catname ?></a></h2>
</div>
<div class="actions">
<button type="button" title="<?php echo $buttontext ?>" class="button btn-cart" onclick="setLocation('<?php echo $parent->getUrl() ?>')"><span><span><?php echo $buttontext; ?></span></span></button>
</div>
</div>
</li>
<?php if ($i%$_columnCount==0 || $i==$count): ?>
</ul>
<?php endif;?>
<?php $j++; endforeach; ?>
</div>
<?php endif; ?>
Any help is much appreciated!