I am new to Magento .
I have a problem while trying to add a block to ‘category.products’, but if I try to add a block to ‘content’, it works perfect. I searched through Stack Exchange, but I couldn’t find any solution for my problem.
In my layout file (located at app/design/frontend/default/hookahs/layout/webwhales/seoblock.xml
), I have the following:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="category.products">
<block type="webwhales_variousmodule/catalog_categoryseo" name="webwhales_seoblock" />
</reference>
</default>
</layout>
My layout file is being loaded, because I can remove a sidebar for example.
The config file looks like this:
<?xml version="1.0" ?>
<!-- Root node for Magento configuration files -->
<config>
<modules>
<WebWhales_VariousModule>
<version>0.1.0</version>
</WebWhales_VariousModule>
</modules>
<global>
<blocks>
<webwhales_variousmodule>
<class>WebWhales_VariousModule_Block</class>
</webwhales_variousmodule>
</blocks>
<models>
<webwhales_variousmodule>
<class>WebWhales_VariousModule_Model</class>
</webwhales_variousmodule>
</models>
</global>
<frontend>
<layout>
<updates>
<webwhales_variousmodule>
<file>webwhales/seoblock.xml</file>
</webwhales_variousmodule>
</updates>
</layout>
</frontend>
</config>
My block class is located at app/code/local/WebWhales/VariousModule/Block/Catalog/Categoryseo.php
and has the following content:
<?php
class WebWhales_VariousModule_Block_Catalog_Categoryseo extends Mage_Core_Block_Template {
public function __construct() {
parent::__construct();
$this->setTemplate( 'webwhales/seoblock.phtml' );
}
}
Right now I have no clue what the problem is or how to solve it. When I change <reference name="category.products">
to <reference name="content">
it works, but my code isn't loaded at the right place; it has to be loaded at the top of category.products
.
I have also tried to change <default>
to <catalog_category_default>
or <catalog_category_layered>
, but that doesn't make a difference either.
<?php echo $this->getChildHtml('webwhales_seoblock');?>
added in that file, but it doesn't work.