1

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

3
  • Is your category page using 2columns-left as a root template ? Commented Sep 6, 2016 at 15:12
  • My category page still hase a sidebar with filters and I want to add a block in top of the filters Commented Sep 6, 2016 at 15:13
  • please provide your config.xml may be we can help you Commented Sep 7, 2016 at 6:12

1 Answer 1

0

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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