Magento – Magento: Category Name vs Page Title Name

categorycategory-attributepage-title

How can a page title name (not meta) be different from the Category "Name"?

For example:

Main Category 1: ABC

Sub-Category (under ABC): DEF

On the navigation menu, the main category is displayed as "ABC" and the sub-category as DEF. However, when I user clicks on the DEF sub-category, how can the page title (on the page) be something other than the (default) DEF name? For example, DEF Stuff.

In other words, how can we have a page title (on the page; not meta) that is different from the category Name (field)?

Best Answer

you can add a new category attribute called page_title. Here is a tutorial on how to do it.
Then edit the template app/design/frontend/{package}/{theme}/template/catalog/category/view.phtml and replace

<h1><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>

with

<h1>
<?php if ($category->getPageTitle()):?>
    <?php echo $_helper->categoryAttribute($_category, $_category->getPageTitle(), 'page_title') ?>
<?php else: ?>
    <?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?>
<?php endif;?>
</h1>

now you can fill in for your DEF category the field page title with DEF stuff and it will be displayed on the page. If you don't fill in the page title field, the category name will be used.

Related Topic