I was some hours trying to move the static block defined at the categories (manage categories -> display settings -> CMS block)
I wanted to have it before the breadcrum but only in the categorie pages that have configure the cms static block
With the help of Tomislav Bilic from inchoo i manage to make it work.
that the steps in case some need it.
1- create your new reference:
I always scare of upercases, hifens and underscores in zend one day i will learn how to use them so i call the reference “categorybanner” and become a reference because the block type is core/text_list (not sure do but works like the other references like left)
<block type="core/text_list" name="categorybanner" as="categorybanner"/>
2 - Use the reference for the categories.
Because we want to be show only at the categories we open:
there is an error show in other posts when you add the reference to the block at the page.xml because at the home page will try to get the category methods and will fail.
also be sure you add the reference at the sections you want to show the banner for example at the layeared navigation layout:
<block type="catalog/category_view" name="catalog.banner" template="catalog/category/banner.phtml" />
I am using the template catalog/category/banner.phtml that uses the methods of catalog/category/view.phtml so in block type you have to put catalog/category_view (you see why i am scearing of underscores)
3 - Now we call the reference from a template
In my case i am using my own call catalog.phtml base in the 2columns-left.phtml
(i wont say how to add your template otherwise i never go to eat my lunch)
If you use your template remember to change the default template at :
Ok now open what ever template you have for your category and add the cade to call the reference:
As I said wanted before the breadcrumbs so i put that before breadcrumbs like that:
<?php echo $this->getChildHtml('categorybanner') ?>
<?php echo $this->getChildHtml('breadcrumbs') ?>
4 - Put the code in the banner.phtml
Create a banner.phtml at:
$_helper = $this->helper('catalog/output');
$_category = $this->getCurrentCategory();
<?php if($this->isMixedMode()): ?>
<?php echo $this->getCmsBlockHtml() ?>
<?php endif; ?>
5- Finaly hide your static block from the main content (you dont want to headers in the same page!!!)
<?php elseif($this->isMixedMode()): ?>
<?php //EGS to implement in category_header.phtml echo $this->getCmsBlockHtml() ?>
<?php echo $this->getProductListHtml() ?>
Hope help someone,
Is not to dificult just about 9 cofees....