Magento – In category page move the category image to top after header

categorymagento-1.9page

I want to display the category image in top of category page just after the header.Currently it is showing in 2colums-left.phtml right side container.I don't want to change the layout but just the image alone need to be displayed on top..

Best Answer

Open

app/design/frontend/PACKAGE/THEME/template/catalog/category/view.phtml

and delete or comment out

if ($_imgUrl = $_category->getImageUrl()) {
    $_imgHtml = '<p class="category-image"><img src="'.$_imgUrl.'" alt="'.$this->escapeHtml($_category->getName()).'" title="'.$this->escapeHtml($_category->getName()).'" /></p>';
    $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
}

This will prevent the image from showing twice.

Then open

app/design/frontend/PACKAGE/THEME/template/page/2colums-left.phtml

after <?php echo $this->getChildHtml('header') ?>

add

    <?php if ($current_category =  Mage::registry('current_category')):?>
        <?php if ($current_category->getImageUrl()):?>
            <?php echo '<p class="category-image"><img src="'.$current_category->getImageUrl().'" alt="'.$this->escapeHtml($current_category->getName()).'" title="'.$this->escapeHtml($current_category->getName()).'" /></p>';?>
        <?php endif?>
    <?php endif?>
Related Topic