1

How to get Magento category page title in frontend? Already tried:

<?php if ($category->getPageTitle()):?>
    <?php echo $_helper->categoryAttribute($_category, $_category->getPageTitle(), 'page_title') ?>
<?php else: ?>

enter image description here

  • yes as suggested in mage i want to display here page title – Payal jhamta Aug 5 '16 at 9:25
  • plz show which error are display? or plz show full code – Rakesh Jesadiya Aug 5 '16 at 9:26
  • hi @Payaljhamta, may i know what kind search box you are using – Gem Aug 5 '16 at 10:32
0

I think, you have a typo here (if you have created page_title attribute) :

Replace <?php if ($category->getPageTitle()):?> WITH <?php if ($_category->getPageTitle()):?>

If you want to get meta_title (this is shown as Page Title in category edit page at admin)

enter image description here

then use :

<?php if ($_category->getMetaTitle()):?>
    <?php echo $_helper->categoryAttribute($_category, $_category->getMetaTitle(), 'meta_title') ?>
<?php else: ?>
  • yes as suggested in mage i want to display here page title so i can add this code in head.html – Payal jhamta Aug 5 '16 at 9:26
  • updated the code/answer – Anil Suthar Aug 5 '16 at 9:26
  • these page title i want to display in frontend as i mentioned in our qustion – Payal jhamta Aug 5 '16 at 9:54
0

You need to rewrite Mage_Catalog_CategoryController

add below code in viewAction after $this->loadLayoutUpdates(); code

<?php if ($category->getMetaTitle()):?>    
       <?php $this->getLayout()->getBlock('head')->setTitle($this->__($category->getMetaTitle())); ?>
<?php else: ?>

How to rewrite controller

  • these page title i want to display in frontend as i mentioned in my qustion – Payal jhamta Aug 5 '16 at 10:15
  • Updated answer please check it – Prashant Valanda Aug 5 '16 at 10:23
  • Please make me clear which file i have to add code – Payal jhamta Aug 5 '16 at 10:25
  • updated answer check it – Prashant Valanda Aug 5 '16 at 10:34
  • Please make me clear where i have add code i.e in which file so that Page title display as per i mentioned in image that i attached in mu question plesae – Payal jhamta Aug 5 '16 at 12:11

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.