Display Image Category above 2 columns left page


The category banner (image) comes from template/catalog/category/view.phtml like this

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

Then in template/page/2columns-left.phtml between<div class="main"> and <div class="col-left"><?php echo $this->getChildHtml('left') ?></div>

write the category banner code

<?php   
        $_category  = Mage::registry('current_category');
        if($_category){
         $_helper    = Mage::helper('catalog/output');

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

This will show the category banner above the left column and the content.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s