I am utilizing template-master's easytab extension for my site. It works great, however, I have a set of tabs that I only need shown for a specific attribute set. They are the same information on each tab for all the products. I have built them as cms blocks and that works fine. But they are on every product. I would like to be able to add some code that checks the attribute set and returns the tab if it is a part of the specified set, otherwise do not show the tab. ANY IDEAS WOULD HELP!! Here is the cms.phtml code from which the tab is created:
<?php
$id = $this->getCmsBlockId();
if (empty($id)) {
return;
}
?>
<div class="product-specs">
<?php
echo $this->getLayout()
->createBlock('cms/block')
->setBlockId($id)
->toHtml();
?>
</div>
I solved it!
1. I added a new file that I named cmstab.phtml in the same folder as cms.phtml
app/design/frontend/base/default/template/tm/easytabs/tab/
*In code below - replace 'yoursetname' with your own attribute set name:
<?php
$_helper = $this->helper('catalog/output');
$_prodID = Mage::registry('current_product')->getId();
$_product = Mage::getModel('catalog/product')->load($_prodID );
$attributeSetModel = Mage::getModel('eav/entity_attribute_set');
$attributeSetModel->load($_product->getAttributeSetId());
$attributeSetName = $attributeSetModel->getAttributeSetName();
?>
<?php if (0 == strcmp($attributeSetName, 'yoursetname')): ?>
<?php
$id = $this->getCmsBlockId();
if (empty($id)) {
return;
}
?>
<div class="product-specs">
<?php
echo $this->getLayout()
->createBlock('cms/block')
->setBlockId($id)
->toHtml();
?>
</div>
<?php endif; ?>
2. In easytab configuration it askes for widget options: Identifier: *put cms block identifier here template: *replace tm/easytabs/tab/cms.phtml with tm/easytabs/tab/cmstab.phtml
3. Refresh your product - it now will only have cms tabs for your attribute set.