Add New Tab to Products Panel – Magento

  • by

Firstly a little background. Our client has two sets of products which have custom finishes. 7mm Products and 10mm Products. These are grouped in attribute sets called 7mm Finishes (attributesetid == 16) and 10mm Finishes (attributesetid == 18) .

We’ll be creating a tab which only shows if a product belongs to specific attribute set .

First, in our case, we’re going to create 2 Static Blocks.
Static Block Number 1:
Block Title: 7mm Finishes
Identifier: swatch16
Status: Enabled
Content: (your colour swatches or custom info)

Static Block Number 2:
Block Title: 10mm Finishes
Identifier: swatch18
Status: Enabled
Content: (your colour swatches or custom info)

Now… lets make some code!


	// We are going to prepend the attribute id with the word swatch
	// This helps us to identify the swatch later (plus,
	// I'm not sure using an attribute ID as a static block name is such a good idea)

	//Did we get this far?
	// Block Identifier is lowercase and has no spaces
		$newname=strtolower(str_replace(' ',"",$name));
	// Only display swatches for attributesetid 16 and 18
		if (($newname=="swatch16") || ($newname=="swatch18")){
	// Annnnnd output the static block!
			echo $this->getLayout()->createBlock('cms/block')->setBlockId($newname)->toHtml();

Look for this section:

<action method="addTab" translate="title" module="catalog"><alias>description</alias><title>Product Description</title><block>catalog/product_view_description</block><template>catalog/product/view/description.phtml</template></action>
<action method="addTab" translate="title" module="catalog"><alias>related_products</alias><title>Related Products</title><block>catalog/product_list_related</block><template>catalog/product/list/related.phtml</template></action>
<action method="addTab" translate="title" module="catalog"><alias>upsell_products</alias><title>We Also Recommend</title><block>catalog/product_list_upsell</block><template>catalog/product/list/upsell.phtml</template></action>
<action method="addTab" translate="title" module="catalog"><alias>additional</alias><title>Additional Information</title><block>catalog/product_view_attributes</block><template>catalog/product/view/attributes.phtml</template></action>

Add the following:

<!-- new tab -->
<action method="addTab" translate="title" module="catalog"><alias>finishes</alias><title>Finishes</title><block>catalog/product_view_finishes</block><template>catalog/product/view/finishes.phtml</template></action>
class Mage_Catalog_Block_Product_View_Finishes extends Mage_Core_Block_Template
    protected $_product = null;

    function getProduct()
        if (!$this->_product) {
            $this->_product = Mage::registry('product');
        return $this->_product;

That should be working for you – but adjust your attributeSetId’s accordingly ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.