Hot File

Build Magento move layered navigation block between the toolbar and product list

View: 428    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: Magento template   Fields: Other

10 point/1 review File has been tested

In this tutorial we are going to see how we can move layered navigation block between the toolbar and product list in the product list page of Magento. By default the layered navigation block appears in the left side bar.

Introduction

Magento move layered navigation block between the toolbar and product list

In this tutorial we are going to see how we can move layered navigation block between the toolbar and product list in the product list page of Magento. By default the layered navigation block appears in the left side bar.

You can use the following piece of code, if you want to move the layered navigation to the content block,

<reference name="content">
     <block type="catalog/layer_view" name="catalog.leftnav" before="product_list" after="product_list_toolbar" template="catalog/layer/view.phtml"/>
</reference>

This will move the layered navigation block from left side to the content block. But it will only appear at the top/bottom of the page. Because, We’ve added the block to the block content which only has two direct child blocks: category.products and product.tooltip. So lets see how we can move layered navigation between the toolbar and product list exactly. To do this we have to add the following code to the layout XML

<?xml version="1.0"?>
<layout version="0.1.0">
    <catalog_category_layered>
        <reference name="left">
            <action method="unsetChild"><alias>catalog.leftnav</alias></action>
        </reference>
        <reference name="product_list">
            <action method="insert"><blockName>catalog.leftnav</blockName></action>
        </reference>
    </catalog_category_layered>
</layout>

This will move the layered navigation block from the left column to the content column without re-creating classes and the like. You can see I inserted the block as a child of the block product_list.

If you call the page now you will see that the layered navigation isn’t displayed at all. That’s because opposed to the content block, the product_list block doesn’t output all child blocks by default. You have to echo the block yourself in the template file.

To do this copy list.phtml (app/design/frontend/base/default/template/catalog/product/list.phtml) file from base theme to your theme. Open the file and find $this->getToolbarHtml(). Place the following code after the line.

<?php echo $this->getChildHtml('catalog.leftnav'); ?>
Magento move layered navigation block between the toolbar and product list

Magento move layered navigation block between the toolbar and product list

After adding the line, if you refresh the page you will see the layered navigation block between the toolbar and product list. Do clear the cache and check if you can not see the block after reloading the page.

Build Magento move layered navigation block between the toolbar and product list

Build Magento move layered navigation block between the toolbar and product list Posted on 19-08-2016  In this tutorial we are going to see how we can move layered navigation block between the toolbar and product list in the product list page of Magento. By default the layered navigation block appears in the left side bar. 10/10 428

Comment:

To comment you must be logged in members.

Files with category

 
Newsletter Email

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd