I have this layout for my products/category view:

<div class="wrapper">
    <?php echo $this->getChildHtml('global_notices') ?>
    <div class="page ">
        <?php echo $this->getChildHtml('header') ?>
        <?php echo $this->getChildHtml('category_title') ?>
        <div class="main-container row collapse col2-left-layout">
            <div class="main large-12 columns">
                <?php // This left_first block will display above the main content on smaller viewports ?>
                <?php if ($_leftContent = $this->getChildHtml('left_first')): ?>
                <div class="col-left sidebar col-left-first large-2 medium-3 columns"><?php echo $_leftContent;   ?></div>
                <?php endif; ?>
                <div class="col-main large-10 medium-9 columns">
                    <?php echo $this->getChildHtml('global_messages') ?>
                    <?php echo $this->getChildHtml('content') ?>
                <div class="col-left sidebar" style="background:green;"><?php echo $this->getChildHtml('left') ?></div>
        <?php echo $this->getChildHtml('footer_before') ?>
        <?php echo $this->getChildHtml('footer') ?>
        <?php echo $this->getChildHtml('global_cookie_notice') ?>
        <?php echo $this->getChildHtml('before_body_end') ?>

In <?php echo $this->getChildHtml('category_title') ?> I want to display my .phtml file that I've created:

    $_helper    = Mage::helper('catalog/output');
    $_category  = Mage::registry('current_category');
    if ( ! $_category) {
        $categoryId = Mage::app()->getRequest()->getParam('id', false);
        $_category = Mage::getModel('catalog/category')
    $_imgUrl = $_category->getImageUrl();
    if (!$_imgUrl){
<script type="text/javascript">
<div class="category-header-container">
    <div class="bgback" style="background:#F7F6F4;">
        <div class="container row" style="<?php if($_imgUrl): ?>background-image: url(<?php echo $_imgUrl; ?>);<?php endif; ?>">
            <div class="table-container">
                <div class="category-top-title">
                    <h1><?php echo $_helper->categoryAttribute($_category, $_category->getName(), 'name') ?></h1>
                <div class="left-area breadcrumbs-holder">
                    <?php echo $this->getChildHtml("breadcrumbs"); ?>
<div class="zn_header_bottom_style"></div>

But, I can't achieve that... I don't know what I'm mising...

I've created this entry in my local.xml inside of <catalog_category_view> tag

<reference name="category_title">
    <block type="core/template" name="page.header" template="page/html/page_header.phtml">
        <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

What I'm missing? Do I need to modify page.xml or catalog.xml ? If yes, could you give me an example what should be added there to make it work?

Thanks guys.


You need to add category_title phtml but don't define at layout xml file so,you need this block at page.xml. As per your code you have add the block reference of root

So need to add the below xml code at page.xml

<reference name="root">
    <block type="core/text_list" name="category_title" as="category_title" translate="label">

core/text_list not work then use core/template

  • Still nothing, so this <block type="core/text_list" name="category-title" as="category-title"></block> has to be in page xml, then this <?php echo $this->getChildHtml('category-title') ?> on mylayout.phtml and then this <reference name="root"> <block type="core/text_list" name="category-title" as="category-title" translate="label" template="page/html/page_header.phtml"></block> </reference> in local.xml ? Is that correct? – Artur Rain Jan 26 '15 at 14:51
  • please set template for this block at page.xml with page.xml and the code <reference name="root"> <block type="core/text_list" name="category-title" as="category-title" translate="label" template="page/html/page_header.phtml"></block> </reference> not need – Amit Bera Jan 26 '15 at 14:56
  • I appologize, but I'm having a hard time to understand what you're saying. So there should be on page.xml inside of <default> this: <block type="core/text_list" name="category-title" as="category-title"></block> and then this: <reference name="root"> <block type="core/text_list" name="category-title" as="category-title" translate="label" template="page/html/page_header.phtml"></block> </reference> ? Both of them has to be in <default>? – Artur Rain Jan 26 '15 at 15:01
  • I'm sorry, but it doesn't work, please confirm, that I've understood you correctly: now I have in my page.xml inside of <default></default> this line: <referencename="root"> <block type="core/text_list" name="category-title" as="category-title" translate="label" template="page/html/page_header.phtml"> </block> </reference> and then on the golulo-cat.phtml (this is my layout.phtml this line: <?php echo $this->getChildHtml('category-title') ?> and it doesn't shop up. – Artur Rain Jan 26 '15 at 15:13
  • where you have add this code: <?php echo $this->getChildHtml('category-title') ?> – Amit Bera Jan 26 '15 at 15:16

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.