title: Magento. Layered navigation is not showing
body: <p>I have CMS page which outputs list of all products. It uses block created by custom extension.</p>
  
  <p>The problem is that it does not output Layered Navigation filters.</p>
  
  <p>Here is CMS page Layout update:</p>
  
  <pre><code>&lt;reference name="content"&gt;
    &lt;block type="wtc_allproducts/list" name="allproducts" template="wtc/allproducts/list.phtml"&gt;
  
      &lt;!-- Layered Navigation Block; setCategoryId sets id of Root category --&gt;
      &lt;block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml" &gt;
        &lt;action method="setCategoryId"&gt;&lt;category_id&gt;2&lt;/category_id&gt;&lt;/action&gt;
      &lt;/block&gt;
  
      &lt;block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"&gt;
        &lt;block type="page/html_pager" name="product_list_toolbar_pager"/&gt;
      &lt;/block&gt;
  
      &lt;action method="setToolbarBlockName"&gt;&lt;name&gt;product_list_toolbar&lt;/name&gt;&lt;/action&gt;
    &lt;/block&gt;
  &lt;/reference&gt;
  </code></pre>
  
  <p><strong>wtc/allproducts/list.phtml</strong> code:</p>
  
  <pre><code>&lt;div class="row"&gt;
    &lt;div class="col-xs-12"&gt;
      &lt;div class="infoblock"&gt;
        &lt;?php echo $this-&gt;getChildHtml('catalog.leftnav'); ?&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;?php if (($_products = $this-&gt;getProductCollection()) &amp;&amp; $_collectionSize = $_products-&gt;getSize()): ?&gt;
  &lt;div class="row"&gt;
    &lt;div class="col-xs-12"&gt;
      &lt;div class="category-products"&gt;
        &lt;div class="row"&gt;
          &lt;?php echo $this-&gt;getToolbarHtml() ?&gt;
  
          &lt;?php foreach ($_products-&gt;getItems() as $_product): ?&gt;
  
            &lt;div class="col-xs-3"&gt;
              &lt;div class="brand product-item"&gt;
                 &lt;a href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;"&gt;&lt;img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(180); ?&gt;" alt="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;" /&gt;&lt;/a&gt;
                &lt;p&gt;&lt;?php echo $this-&gt;htmlEscape($_product-&gt;getName()) ?&gt;&lt;/p&gt;
  
                &lt;div class="price"&gt;&lt;?php echo $this-&gt;getPriceHtml($_product, true) ?&gt;&lt;/div&gt;
  
                &lt;?php if($_product-&gt;isSaleable()): ?&gt;
                  &lt;input type="image" class="button btn-cart" src="&lt;?php echo $this-&gt;getSkinUrl('images/assets/addtocart.png'); ?&gt;" style="height: 34px;" alt="&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;" onclick="setLocation('&lt;?php echo $this-&gt;getAddToCartUrl($_product) ?&gt;')"&gt;
                &lt;?php else: ?&gt;
                  &lt;p class="availability out-of-stock"&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/span&gt;&lt;/p&gt;
                &lt;?php endif; ?&gt;
  
              &lt;/div&gt;&lt;!-- /.brand.product-item --&gt;
            &lt;/div&gt;&lt;!-- /.col-xs-3 --&gt;
          &lt;?php endforeach ?&gt;
        &lt;/div&gt;&lt;!-- /.row --&gt;
  
        &lt;div class="toolbar-bottom"&gt;
          &lt;?php echo $this-&gt;getToolbarHtml() ?&gt;
        &lt;/div&gt;&lt;!-- /.toolbar-bottom --&gt;
  
      &lt;/div&gt;&lt;!-- /.category-products --&gt;
    &lt;/div&gt;&lt;/div&gt;
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p><strong>WTC/AllProducts/Block/List.php</strong> code:</p>
  
  <pre><code>&lt;?php
  
  class WTC_AllProducts_Block_List extends Mage_Catalog_Block_Product_Abstract
  {
    protected $_defaultToolbarBlock = 'catalog/product_list_toolbar';
  
    protected $_allProductsCollection;
  
    protected function _getAllProductsCollection()
    {
      if (is_null($this-&gt;_allProductsCollection)) {
        $layer = Mage::getSingleton('catalog/layer');
  
        $this-&gt;_allProductsCollection = $layer-&gt;getProductCollection();
  
        $this-&gt;getToolbarBlock()-&gt;removeOrderFromAvailableOrders('position');
        $this-&gt;getToolbarBlock()-&gt;removeOrderFromAvailableOrders('aitmanufacturers_sort');
  
        $this-&gt;_allProductsCollection-&gt;setPage(
          $this-&gt;getToolbarBlock()-&gt;getCurrentPage(),
          $this-&gt;getToolbarBlock()-&gt;getLimit()
        );
      }
  
      return $this-&gt;_allProductsCollection;
    }
  
    public function getAllProductsCollection()
    {
      return $this-&gt;_getAllProductsCollection();
    }
  
  
    public function getMode()
    {
      return $this-&gt;getChild('toolbar')-&gt;getCurrentMode();
    }
  
    protected function _beforeToHtml()
    {
      $toolbar = $this-&gt;getToolbarBlock();
  
      // called prepare sortable parameters
      $collection = $this-&gt;_getAllProductsCollection();
  
      // use sortable parameters
      if ($orders = $this-&gt;getAvailableOrders()) {
        $toolbar-&gt;setAvailableOrders($orders);
      }
      if ($sort = $this-&gt;getSortBy()) {
        $toolbar-&gt;setDefaultOrder($sort);
      }
      if ($dir = $this-&gt;getDefaultDirection()) {
        $toolbar-&gt;setDefaultDirection($dir);
      }
      if ($modes = $this-&gt;getModes()) {
        $toolbar-&gt;setModes($modes);
      }
  
      // set collection to toolbar and apply sort
      $toolbar-&gt;setCollection($collection);
  
      $this-&gt;setChild('toolbar', $toolbar);
      Mage::dispatchEvent('catalog_block_product_list_collection', array(
        'collection' =&gt; $this-&gt;_getAllProductsCollection()
      ));
  
      $this-&gt;setProductCollection($collection);
  
      return parent::_beforeToHtml();
    }
  
    public function getToolbarBlock()
    {
      if ($blockName = $this-&gt;getToolbarBlockName()) {
        if ($block = $this-&gt;getLayout()-&gt;getBlock($blockName)) {
          return $block;
        }
      }
      $block = $this-&gt;getLayout()-&gt;createBlock($this-&gt;_defaultToolbarBlock, microtime());
      return $block;
    }
  
    public function getToolbarHtml()
    {
      return $this-&gt;getChildHtml('toolbar');
    }
  
    public function setCollection($collection)
    {
      $this-&gt;_allProductsCollection = $collection;
      return $this;
    }
  }
  </code></pre>
  
  <p>I don't see where is my mistake.</p>