I have created the following to allow a different static CMS block to displayed on the product page depending on the category ID.
<?php
$_category_detail=Mage::registry('current_category'); //Get the current category id
$product = Mage::getModel('catalog/product')->load($product_id); //Get the current category id
$category = Mage::getModel('catalog/layer')->getCurrentCategory(); //Get the current category id
?>
<?php if($category->getId()==23): ?>
<div id="sizingmap">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('sizespecpantsslim')->toHtml(); ?>
</div>
<?php endif;?>
<?php if($category->getId()==10): ?>
<div id="sizingmap">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('sizespecjacket')->toHtml(); ?>
</div>
<?php endif;?>
Everything is fine for the category part, though i would like to display a different block based on the product id in the same category.
For example (this is obviously not correct):
<?php if($category->getId()==23) "AND the product id are "372,363,354,349,344": ?>
<div id="sizingmap">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('sizespecpantsslim')->toHtml(); ?>
</div>
else // if they are not the mentioned product id's
<div id="sizingmap">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('sizespecpantsstd')->toHtml(); ?>
</div>