Question

I'm using Magento v. 1.6.2.0. I have set the Category layered navigation filters to appear horizontally in my site and using the 1 column page layout. I have also set a category image.

Therefore, when you navigate to that category category, the catalog list front elements appear in these order from top to down:

Layered Navigation filters > Category Image > Grid of products.

And I would like to change that order to this one:

Category Image > Layered Navigarion Filters > Grid of Products.

I have tried to modify the catalog.xml file, but I haven't been able to make it work:

 ...
 <catalog_category_layered translate="label">
        <label>Catalog Category (Anchor)</label>
        <reference name="left">
            <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
        </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"/>

 ...

Any good advice for this?

Was it helpful?

Solution

All this block are odded in the content block, this is Mage_Core_Text_List type and order the block in his content. You can see this behaviour in the next function:

protected function _toHtml()
{
    $this->setText('');
    foreach ($this->getSortedChildren() as $name) {
        $block = $this->getLayout()->getBlock($name);
        if (!$block) {
            Mage::throwException(Mage::helper('core')->__('Invalid block: %s', $name));
        }
        $this->addText($block->toHtml());
    }
    return parent::_toHtml();
}

Highlight

$this->getSortedChildren()

For this reason the block will be ordered in you content block. Can you try to order with before and after statement.

For example:

<block .... as="layered" after="category.image"/>
<block .... as="category.image" before="-"/>
<block .... as="grid.product after="layered"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top