Thursday, 15 January 2015

magento - Move static block to top of each category page -



magento - Move static block to top of each category page -

currently when add together cms static block category pages via category display settings shows inline left column. appear above, left column , products under.

so visually,

instead of:

left column | static block

| products

i it:

static block

left column | products

any ideas?

assuming using 2 columns left-bar.phtml

you have create new structural block layout

modify 2columns-left.phtml file

..... <div class="wrapper"> <?php echo $this->getchildhtml('global_notices') ?> <div class="page"> <?php echo $this->getchildhtml('header') ?> <div class="main-container col2-left-layout"> <div class="main"> <?php echo $this->getchildhtml('breadcrumbs') ?> <?php echo $this->getchildhtml('categorystaticblock'); //<---new block ?> <div class="col-main"> <?php echo $this->getchildhtml('global_messages') ?> <?php echo $this->getchildhtml('content') ?> </div> <div class="col-left sidebar"><?php echo $this->getchildhtml('left') ?></div> </div> </div> <?php echo $this->getchildhtml('footer') ?> <?php echo $this->getchildhtml('before_body_end') ?> </div> </div> .....

now in catalog.xml declare what's within new structural block

<catalog_category_default translate="label"> <label>catalog category (non-anchor)</label> <reference name="categorystaticblock"> <block type="catalog/category_view" name="categorystatickblock" as="categorystatickblock" template="catalog/category/staticblock.phtml"> </reference> <reference name="left"> <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> </reference> <reference name="content"> ....

now create new file catalog/category/staticblock.phtml

<?php if($this->iscontentmode() ||$this->ismixedmode()): ?> <?php echo $this->getcmsblockhtml() ?> <?php endif; ?>

now remove or coment out catalog/category/view.phtml the

<?php echo $this->getcmsblockhtml() ?>

lines echo cms block otherwise twice on page

hope helps

bye giuseppe

magento

No comments:

Post a Comment