简体   繁体   中英

Add Filtered Layered Navigation to 1 Column Category Pages in Magento

I'm running Magento 1.9.1.0 with the RWD theme. When setting the page layout to 2 columns with left bar I can see the filters in the left sidebar correctly (sort by price etc). How can I get this working in the 1 column page layout (for categories only)? I'd like to create a full-width version of this at the top of my products using something like the Catalin SEO catalog layered navigation (for the slide price bar etc).

The 1column.phtml template does not have the left block, which is where the layer view block is usually injected. One way to do this in your local.xml is to put the block in the content (or after_body_start or before_body_end, or any core/text_list child block):

<catalog_category_default>
    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
            <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
        </block>
    </reference>
</catalog_category_default>

In your css, you can hide the layer block html if you don't want it to show but still want it to load:

.category-mycategory .block-layered-nav {
    display: none;
}

mycategory is your category name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM