Magento 1.9 – Insert Block in Left Sidebar of Layered Navigation

blocksextensionsmagento-1.9PHPtemplate

i wrote an extension for adding an block on the left sidebar of the catalog_category_layered , but I don't know why it's not rendered.

I've got an extra xml file for my extension (which is working because it also does some other stuff) which a part looking like this:

<catalog_category_layered>
    <reference name="left">
        <block type="categories/sidebar" name="categories.sidebar" template="foobar/categories/sidebar.phtml">
        </block>
    </reference>
</catalog_category_layered>

And I have a Class which looks like this:

class Foobar_Categories_Block_Sidebar extends Mage_Core_Block_Template {
    public function getFoo() {
        return 'foooooooo';
      }
    }

for the Block class I have another question: Which class should I inherit if I want to print out some categories based on the category I'm watching?

and a template which looks like this:

<div class="block block-categories">
  <div class="block-title">
    <strong><span><?php echo $this->__('Categories') ?></span></strong>
  </div>
  <div class="block-content">
      <?php echo $this->getFoo();?>
  </div>
</div>

My config.xml looks like this:

<config>
    <modules>
        <Foobar_Categories>
            <version>0.1.1</version>
        </Foobar_Categories>
    </modules>
    <global>
        <models>
            <foocategories>
                <class>Foobar_Categories_Model</class>
            </foocategories>
        </models>
        <helpers>
            <foocategories>
                <class>Foobar_Categories_Helper</class>
            </foocategories>
        </helpers>
        <blocks>
            <foocategories>
                <class>Foobar_Categories_Block</class>
            </foocategories>
        </blocks>

        <resources>
            <foocategories_setup>
                <setup>
                    <module>Foobar_Categories</module>
                    <class>Mage_Eav_Model_Entity_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </foocategories_setup>
        </resources>
    </global>
    <frontend>
        <layout>
            <updates>
                <foocategories module="Foobar_Categories">
                    <file>Foobar/categories.xml</file>
                </foocategories>
            </updates>
        </layout>
        <translate>
            <modules>
                <Foobar_Categories>
                    <files>
                        <foocategories>Foobar_Categories.csv</foocategories>
                    </files>
                </Foobar_Categories>
            </modules>
        </translate>
    </frontend>
</config>

I don't think that there are any problems in my config.xml because the extension is doing other stuff with layout and blocks which works perfectly.

The left sidebar with my filters is shown, but my block isn't rendered in the sidebar.
But where is my error?

cheers
bambamboole

Best Answer

I got your problem and change your layout Xml code as below

<catalog_category_layered>
  <reference name="left">
    <block type="foocategories/sidebar" name="categories.sidebar" template="foobar/categories/sidebar.phtml">
    </block>
  </reference>
</catalog_category_layered>

Problem With your block name just change as shown above and it will work

Related Topic