Magento – Create product tab that displays custom attribute – Ultimo Theme

ce-1.9.1.0tabs

On the product page, I would like to create a new tab next to the description tab named 'What's Included'.

I have created a attribute with text area named included to display what items that come with a product.

Here is the section of code in the local.xml file of the theme for the tabs:

<block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs" template="catalog/product/view/tabs.phtml" >

            <!-- Product description -->
            <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>

If I duplicate the Product Description tab code above it will add another description tab but I do not know how to change it to be the included tab.

Also, I understand that I need to create .phtml file such as included.phtml but do not know what to put in that file to display the included attribute info.

Best Answer

Please follow bellow steps

Step : 1

Add included tab code in local.xml file (add code after line no. 388)

<action method="addTab" translate="title" module="catalog"><alias>included</alias><title>What's Included</title><block>catalog/product_view_attributes</block><template>catalog/product/view/included.phtml</template></action>

Step : 2 Create new file included.phtml in location (app\design\frontend\ultimo\default\template\catalog\product\view)

and add bellow code in file

<?php
    $_helper = $this->helper('catalog/output');
    $_product = $this->getProduct()
?>
<?php if ($_included = $this->getProduct()->getIncluded()): ?>
    <h2><?php echo $this->__('included') ?></h2>
    <div class="std">
        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_included, 'included') ?>
    </div>
<?php endif; ?>

Note : Please clear magento Cache in admin side