Hi guys if you are looking for how to make your own custom
tag in magento product description section like specification, benefits or
ingredients you need to play with attributes. In my case I have made two tabs benefits
or ingredients. The process of adding extra tabs I am describing here hope this
will help you.
1.
You need to modify a file which is
app/design/frontend/YOUR_THEME/default/layout/catalog.xml
Look for the code
<block type="catalog/product_view_description"
name="product.description" as="description"
template="catalog/product/view/description.phtml">
<action
method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle"
translate="value"><value>HOW TO
USE</value></action>
</block>
Under this code you need to add a block in my case I have
added two blocks
<block type="catalog/product_view_attributes"
name="product.benefits" as="benefits"
template="catalog/product/view/benefits.phtml">
<action
method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle"
translate="value"><value>BENEFITS</value></action>
</block>
<block type="catalog/product_view_attributes"
name="product.ingredients" as="ingredients"
template="catalog/product/view/ingredients.phtml">
<action
method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle"
translate="value"><value>INGREDIENTS</value></action>
</block>
After that you need to create phtml file for each block
which will be saved under app/design/frontend/YOUR_TEMPLATE/default/template/catalog/product/view
I have made two files benefits.phtml and ingredients.phtml
as described you I had added two blocks under these phtml file you need to
write some codes. In benefits I have written
<?php $_helper = $this->helper('catalog/output');
?>
<?php $_product = $this->getProduct(); ?>
<?php if ($_product->getbenefits()):?>
<div class="short-benefits">
<h2><?php echo $this->__('benefits') ?></h2>
<div class="std"><?php echo
$_helper->productAttribute($_product, nl2br($_product->getbenefits()),
'benefits') ?></div>
</div>
<?php endif;?>
And in ingredients I have written
<?php $_helper = $this->helper('catalog/output');
?>
<?php $_product = $this->getProduct(); ?>
<?php if ($_product->getingredients()):?>
<div class="short-ingredients">
<h2><?php echo $this->__('ingredients') ?></h2>
<div class="std"><?php echo
$_helper->productAttribute($_product, nl2br($_product->getingredients()),
'ingredients') ?></div>
</div>
<?php
endif;?>
Once these you have completed you need to login to you
magento admin panel and go to
Catalog->attributes->manage attribute
Click on add new and assign the same name as defined in the
block like in name=” product.benefits” then make the attribute with benefits
name in Catalog Input Type for Store Owner select text area.
If you wish to allow html editor then in Enable WYSIWYG select
yes
Now in the left hand side manage label / options
Put the name of the tab like benefits
Now you have made your attribute to assign it you need go to
catalog->attributes-> manage attribute sets
Over these select default. Once you click on default you
will see in right Unassigned Attributes with the attribute that you have made
simpally you need to drag it to your group I had put it after short_description
and click on save. Now you are done.
Go catalog manage product and you will see a box that will
ask you to enter benefits once you put the content over there it will show up
in your produt desctiption page or product view page of your mangento store.
final result