2

All the category pages are 1column layout. i had created a sticky sidebar in the list.phtml

.....
..... 
    </ul>
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
<?php endif; ?>
<div class="sticky-button">&nbsp;
<div class="sticky">
 // need the layered navigation here
</div>
</div>

i had tried :

<?php echo $this->getLayout()->createBlock('catalog/layer_view')->setTemplate('catalog/layer/view.phtml')->toHtml() ?> 

definitely this is causing some problems with

$_renderers = $this->getParentBlock()->getChild('state_renderers')->getSortedChildren(); 

In state.phtml

and it will display(only displays) if i assign $_renderers=null, but its clear that it will not filter any products

enter image description here

I had commented the left.nav block in catalog.xml file as shown below since im using a single column layout.

<label>Catalog Category (Anchor)</label>
    <reference name="left_first">
        <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> 
  • which magento are you using? – Amit Bera Apr 20 '15 at 8:27
  • @AmitBera magento 1.9 CE – Shan Apr 20 '15 at 8:29
  • show left nav catalog.xml code – Amit Bera Apr 20 '15 at 8:30
  • @AmitBera question updated with with left/nav code, please note that im using 1column layout. – Shan Apr 20 '15 at 8:48
3

Got the solution: My layout for the category page is 1column set with local.xml

kept catalog.xml unchanged.Reference for the block is still there as shown below:

<reference name="left_first">
        <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>

with in my list.phtml i called:

<div class="sticky-button">&nbsp;
    <div class="sticky">
    <?php echo $this->getLayout()->getBlock('catalog.leftnav')->toHtml();?>
    </div>
</div>

I had noticed problem with sticky sidebar in search results, because the searchresult dont have the block catalog.leftnav hence updated code by::

<?php if(!isset($_REQUEST['q'])){
    echo $this->getLayout()->getBlock('catalog.leftnav')->toHtml();
    }
else {
    echo $this->getLayout()->getBlock('catalogsearch.leftnav')->toHtml();
}
0

Hi you can do this by layout change at xml

Just change the reference name from left_first to product_list this make the layer navigation as child block of product list page .

On list.phtml call this block using

<?php
    echo $this->getChildHtml('"catalog.leftnav');?>
?>

And

Then xml look like:

<reference name="product_list"><!-- change has been done here -->
        <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>
  • Thanks for ur help, But its not working, no left nav yet – Shan Apr 20 '15 at 10:09
  • change catalog.leftnav to my.leftnav – Amit Bera Apr 20 '15 at 10:12
  • $this->getChildHtml('my.leftnav'); is not not showing anything – Shan Apr 20 '15 at 11:15
  • i had solved it!! – Shan Apr 20 '15 at 12:21
0

You can add in your local.xml

<catalog_category_layered>
    <reference name="product_list">
        <block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml">
            <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
        </block>
    </reference>
</catalog_category_layered>

and in list.phml

<?php echo $this->getChildHtml('catalog.leftnav'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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