I've created a custom module in Magento but the methods I have defined for my block are not working for some reason. I can create an instance of the block in a template and call the parent blocks methods but not the methods I have defined.


class MyCompany_Morecategories_Block_List extends Mage_Core_Block_Template

  public function getMoreCategories() {
    return 'More categories';

Then in my template file, if I run $this->getMoreCategories() it returns null.

I've tried running get_class($this), and it returns MyCompany_Morecategories_Block_List.

I've also run get_class_methods($this) but it only returned the parent blocks methods.

I can't imagine why my methods are not working.

Edit: Here is my config.xml file for the module:

<?xml version="1.0"?>

Edit 2: Here is the custom layout update xml code I have for the category

<reference name="content">
  <block type="morecategories/list" name="morecategories_list"   template="mycompany/catalog/category/more.phtml"/>
  • Do you have APC, or similar, running that might have cached an old version of this class? Or are you using Magento's compilation mode which has an old version of the file in the compiled state? Mar 4, 2014 at 20:15
  • Both the cache and compiler are disabled
    – ZeLoubs
    Mar 5, 2014 at 15:58

1 Answer 1


Did you update your layout xml block type? Does it work if you try:

<block type="morecategories/list" name="morecategories_list" template="PATH TO YOUR TEMPLATE"/>
  • This is how I referenced the block. I'm inserting this block through the custom layout update in the admin for a category.
    – ZeLoubs
    Mar 5, 2014 at 16:00
  • Can you post more of your code? And ill try my best to help you. Mar 5, 2014 at 19:26
  • I have edited my question to include the config.xml file. Anything else you need?
    – ZeLoubs
    Mar 5, 2014 at 20:01
  • Can you share what xml code you are using to update the layout in the admin panel? And where are you hoping to output this data? Mar 5, 2014 at 20:49
  • Question updated with custom layout update xml
    – ZeLoubs
    Mar 6, 2014 at 15:20

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.