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">
        <reference name="category.products">
            <block type="webwhales_variousmodule/catalog_categoryseo" name="webwhales_seoblock" />

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 -->

My block class is located at app/code/local/WebWhales/VariousModule/Block/Catalog/Categoryseo.php and has the following content:

    class WebWhales_VariousModule_Block_Catalog_Categoryseo extends Mage_Core_Block_Template {
        public function __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.

  • May be you have place seoblock.xml at wrong location. If Checking this,you can put this file at app/design/frontend/base/default/layout/webwhales/seoblock.xml from app/design/frontend/default/hookahs/layout/webwhales/seoblock.xml
    – Amit Bera
    Feb 10, 2016 at 9:58
  • What's the content of you catalog/category/view.phtml template ? Feb 10, 2016 at 10:01
  • @AmitBera my layout file still get loaded because i tried to remove 'left' and 'right' blocks and it got removed. @DigitalPianism i have <?php echo $this->getChildHtml('webwhales_seoblock');?> added in that file, but it doesn't work.
    – klict
    Feb 10, 2016 at 10:14

1 Answer 1


category.products template file is view.phtml ( app/design/frontend/Your_Package/Your_Theme/template/catalog/category).

Here the child block does not automatically render.You need to call the child block by

echo $this->getChildHtml('webwhales_seoblock');
  • thanks for your answer but i have tried it but it doens't work.
    – klict
    Feb 10, 2016 at 10:09
  • Chnage handler tp catalog_category_view
    – Amit Bera
    Feb 10, 2016 at 10:11
  • what do you mean by handler?
    – klict
    Feb 10, 2016 at 10:15
  • just change '<default>' to '< catalog_category_view>'
    – Amit Bera
    Feb 10, 2016 at 10:15
  • 1
    Thanks for your answer, i changed the handler to 'catalog_category_layered' and it worked
    – klict
    Feb 10, 2016 at 11:38

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.