14Dec/103

How Can I Rename The Product Details Heading?

We were asked to rename the standard "Details" heading on the product view page to something other than "Details". Since it is the Description attribute this should be easy to rename, right? Ha! You'd like that, wouldn't you! Unfortunately that doesn't work. I looked at the template catalog/product/view.phtml and found a rather confusing bit of code:

    <div class="product-collateral">
<?php foreach ($this->getChildGroup('detailed_info', 'getChildHtml') as $alias => $html):?>
        <div class="box-collateral <?php echo "box-{$alias}"?>">
            <?php if ($title = $this->getChildData($alias, 'title')):?>
            <h2><?php echo $this->escapeHtml($title); ?></h2>
            <?php endif;?>
            <?php echo $html; ?>
        </div>
<?php endforeach;?>
        <?php echo $this->getChildHtml('upsell_products') ?>
        <?php echo $this->getChildHtml('product_additional_data') ?>
    </div>

Notice the 5th line. This is where 'Details' is printed out. But where does it actually come from? Let's take a look at your theme's layout/catalog.xml file. Find the block "catalog/product_view_description". It explains a lot:

<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>
</block>

We find that it loads the template catalog/product/view/description.phtml. And that's where it comes from. Take a look at the file:

<?php $_description = $this->getProduct()->getDescription(); ?>
<?php if ($_description): ?>
    <h2><?php echo $this->__('Details') ?></h2>
    <div class="std">
        <?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), $_description, 'description') ?>
    </div>
<?php endif; ?>

There you have it. Now you can change it back to "Description" so it actually matches the attributes title. Or of course to whatever you like...

About Dave Haefliger

Dave “2.0” Haefliger is a simple and effective solutions kind of guy. He loves building applications that feel intuitive. Dave has an unnatural love for almost everything that comes from Apple. Most people don’t understand it, but he doesn’t care, really.
Comments (3) Trackbacks (0)
  1. Thank you for this! The product description wasn’t showing up at all on the product page of my site. This step by step by step I was able to see that my catalog/product_view_description block was missing: detailed_info. This solved my problem! the great easter egg search that is Magento.

  2. Thank you. I was trying to find how the description link to the catalog.xml layout file.


Leave a comment


No trackbacks yet.