3

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)?

  • Which Magento version are you using? The page title can be different from the Name and therefore this should answer you question? – Klettseb Feb 11 '16 at 9:04
  • currently 1.9.2.0 – Mak Feb 12 '16 at 12:14
  • Indeed there is a different field for Page Title but from what I see the data entered there appear on meta (browser Page Title) and not on the actual page (title). – Mak Feb 12 '16 at 12:16
  • When I'm back to a place with normal internet I can paste the code I've used to do that so Monday morning ;-) – Klettseb Feb 12 '16 at 12:28
2

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.

|improve this answer|||||
  • Thank you very much, Marius! I'll follow you your instructions and get back to you! – Mak Feb 11 '16 at 14:47
  • @Marius, I have same issue. I tryed this solution but not work on my site magento 1.9.3.1... Do you have another suggest? – Joso Nov 30 '16 at 17:25
  • Suppose you want the page title also as the html ahref title attribute in the menu? (Navigation php block) – snh_nl Feb 4 '19 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.