Вставка блока в левую боковую панель многоуровневой навигации
Я написал расширение для добавления блока на левой боковой панели catalog_category_layered
, но я не знаю, почему он не отображается.
У меня есть дополнительный xml-файл для моего расширения (который работает, потому что он также выполняет некоторые другие функции), часть которого выглядит следующим образом:
<catalog_category_layered>
<reference name="left">
<block type="categories/sidebar" name="categories.sidebar" template="foobar/categories/sidebar.phtml">
</block>
</reference>
</catalog_category_layered>
И у меня есть класс, который выглядит так:
class Foobar_Categories_Block_Sidebar extends Mage_Core_Block_Template {
public function getFoo() {
return 'foooooooo';
}
}
Для класса блоков у меня есть еще один вопрос: какой класс я должен наследовать, если я хочу распечатать некоторые категории на основе категория, за которой я наблюдаю?
И шаблон, который выглядит следующим образом:
<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>
Мой config.xml выглядит примерно так:
<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>
Я не думаю, что в моем config.xml потому что расширение делает другие вещи с макетом и блоками, которые отлично работают.
Отображается левая боковая панель с моими фильтрами, но мой блок не отображается на боковой панели. Но в чем моя ошибка?
Ура бамбамбулу
1 answers
Я понял вашу проблему и изменил ваш Xml-код макета, как показано ниже
<catalog_category_layered>
<reference name="left">
<block type="foocategories/sidebar" name="categories.sidebar" template="foobar/categories/sidebar.phtml">
</block>
</reference>
</catalog_category_layered>
Проблема с именем вашего блока просто измените, как показано выше, и он будет работать