Im trying to add an alternate header template for product pages. currently it is using a page template 1columnNogrid.phtml. the line for the header is <?php echo $this->getChildHtml('header') ?>

I created a duplicate header.phtml file and called it "product_header"

But I cant work out where and how to define this as a child html?

I tried adding a reference to local.xml but not joy?

Sorry I am new to this and tried to look at other examples but am at a loss to why it will not work.

Thank you in advance.

1 Answer 1


The header block sets its template in the _construct function so by default it's hardcoded to page/html/header.phtml.

public function _construct()

Depending on what exactly you need to do in your custom header.phtml file you could probably get away with just overriding the template by placing your custom version in app/design/frontend/YOUR_PACKAGE/YOUR_THEME/template/page/html/header.phtml. Note that that will cause your custom template to be displayed for all pages and not just the product view page so you would have to do some checking to figure out when you want to display the custom content you want to show for product view pages.

Another option would be to add a rewrite for the Mage_Page_Block_Html_Header class so you can add that check to the block class instead to control which template is shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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