1

I’ve a problem to place a block right after the category description on a category page.

I’ve got a separated layout xml file for a new filtered navigation. The xml is:

 <catalog_category_layered> 
    <remove name="catalog.leftnav" />
    <remove name="enterprisecatalog.leftnav"/> 
    <reference name="left">
       <block type="amshopby/catalog_layer_view" name="amshopby.navleft" after="currency" template="catalog/layer/view.phtml"/>
    </reference>
    <reference name="content">
            <block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>
            <block type="amshopby/top" name="amshopby.top" before="category.products" template="amshopby/top.phtml"/>
    </reference>
</catalog_category_layered> 

So it’s this line which places this block at the beginning of the content area of my category page:

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>

So now my category page looks like this:

filtered navigation -> category title -> category description -> product overview

But I’d like to rearrange it so that it looks like

category title -> category description -> filtered navigation -> product overview

But how I can place this block after the description? It’s a new block which includes the title, description, products etc.:

(standard catalog.xml)

 <catalog_category_layered translate="label">
    <label>Catalog Category (Anchor)</label>
    <reference name="left"></reference>
    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                    <!-- The following code shows how to set your own pager increments -->
                    <!--
                        <action method="setDefaultListPerPage"><limit>4</limit></action>
                        <action method="setDefaultGridPerPage"><limit>3</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
                    -->
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>
    </reference>
</catalog_category_layered> 

I really have no idea how to add this block after the category description. I’m new to magento and the block system is quiet confusing. I’ve tried things like

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="product_list_toolbar" template="amshopby/view_top.phtml"/>

But this doesn’t work. I also tried to add this block code in catalog.xml but then it's not shown.

Does anybody has an idea what I can do? Thank you for your help!

1
  • What I'd advise that, filter navigation (aka layered navigation) is part of Left section. You need to remove it from left and add inside the contentsection in catalog.xml Find the line <?php if($_description=$this->getCurrentCategory()->getDescription()): ?> in magento/app/design/frontend/base/default/template/catalog/category/view.phtml. After if condition call $this->getChildHtml('amshopby.navtop'). This should work. But with Experience you'll be needing few more tweaking
    – SAM
    Sep 27, 2012 at 10:46

1 Answer 1

3

In amshopby.xml, cut the following lines of XML:

<block type="amshopby/catalog_layer_view_top" name="amshopby.navtop" before="-" template="amshopby/view_top.phtml"/>
<block type="amshopby/top" name="amshopby.top" before="category.products" template="amshopby/top.phtml"/>

Then in catalog.xml, paste those two lines here:

<catalog_category_layered translate="label">
<!-- ... -->
<reference name="content">
<!-- ... -->
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">

<!-- paste XML here -->

<!-- ... -->
</reference>
</catalog_category_layered>

Then in template/catalog/category/view.phtml paste in this line:

<?php echo $this->getChildHtml('amshopby.navtop'); ?>

After the following:

<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description std">
    <?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?>
</div>
<?php endif; ?>

That should do it.

2
  • Thank you for your answer. But when I try this, nothing from the amshopby block is shown. There is no error, just empty space.
    – Raisis
    Oct 1, 2012 at 16:00
  • Did you paste those two lines of XML after the category.products block? I've done this for a store I'm working on using the Improved Navigation module and it's working well. Oct 2, 2012 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.