I've been stuck with this for few day's now and can't understand why the category image is not retrieved by magento.

I've added this page_header.phtml to the template/page/html folder with the following html:

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

Then went to the local.xml and added this:

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

It show's up correctly on the category pages, but the issue is that the image is not being displayed and I can't figure out why.

The folder's on the server media and var has 777 permisions. The image is uploaded in the backend. Did I forget something?

Thanks guys,


1 Answer 1


using this step you can display category menu into navigation menu bar.


  • or $_imgHtml = ''; if ($_imgUrl = $_category->getImageUrl()) { $_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$_category->getName().'" />'; $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image'); } Sep 8, 2014 at 9:46
  • Could you please show where shoud I put this line? I'm quite new to developing magento and I don't understand exactly where should I put this. Thanks
    – Artur Rain
    Sep 8, 2014 at 9:52
  • check this :stackoverflow.com/questions/22539210/… Sep 8, 2014 at 9:53
  • When I replace the PHP with the one provided in the answer i get an error: Call to a member function getImageUrl() on a non-object in
    – Artur Rain
    Sep 8, 2014 at 9:56
  • from this you can get Image url Mage::getModel('catalog/category')->load($category->getId())->getImageUrl(); Sep 8, 2014 at 10:00

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