magentomagento-1.7magento-1.6

Magento 1.7.0.2 - Display Image Category above 2 columns left page


My category product page has this layout : 2 columns with left sidebar.

When i set my category image it goes up just in 1 column ( category page ).

How can i make for the category image to go above both columns, category page and sidebar ?


Solution

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

    $_imgHtml   = '';
    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.