I need to change the h1 title using Custom Layout Update field in the category edit view

How can I do this? Change many categories h1 titles without change the category name?

  • Can this also be done for sub-categories? – Richard Sep 13 '18 at 11:01
  • This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review – Piyush Sep 13 '18 at 11:27
  • The code can't be found in my template (it is in the default, not in mine). Can you assist me? Here's my view.phtml <?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magentocommerce.com so we can send you a copy immediately. – Michel Nov 9 '18 at 14:29
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – Vivek Kumar Nov 9 '18 at 20:27
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – Murtuza Zabuawala Nov 10 '18 at 4:30

I assume you are using Magento 1.

This solution tested on Magento

Here is what you can try:

1 - In category Custom Layout Update:

    <reference name="category.products">
      <action method="setAltName"><value>new h1 name</value></action>

2 - In this file below replace the code to add the H1 tag.

File: app/design/frontend/[yourPackage]/[yourTheme]/template/catalog/category/view.phtml

Content to change:

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

3 - Clear Magento cache.

This solution uses AltName for H1 and if it is not set it uses category name.

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