I have a custom Block which I'm now trying to break into two sepparate blocks.

Here's my folder structure (on app/code/local/MyNamespace/CustomerDashboard):

enter image description here

Since I want to break the functions of this module into two smaller parts I added the files MyMenu.php on Block folder, and MyMenuController.php into controllers.

Then, I just copy/pasted the code from Deliverydetails.php into MyMenu.php and DeliverydetailsController.phpinto MyMenuController.php just to see if it would work.

I went into my local.xml and added the reference to my module and it's template:

<reference name="left">
        <block type="customerdashboard/mymenu" name="customerdashboard.mymenu" template="customer/form/my-menu.phtml"/>

When I access the page where I should be seeing the content, there is nothing in the place where the module should be, but I went to check on the exceptions.log and found this:

exception 'Mage_Core_Exception' with message 'Invalid block type: MyNamespace_CustomerDashboard_Block_Mymenu' in /var/www/html/mysite/public_html/app/Mage.php:595
Stack trace:
#0 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block type...')
#1 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('customerdashboa...', Array)
#2 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('customerdashboa...', 'customerdashboa...')
#3 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('customerdashboa...', 'customerdashboa...')
#4 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /var/www/html/mysite/public_html/app/code/core/Mage/Customer/controllers/AccountController.php(107): Mage_Core_Controller_Varien_Action->loadLayout()
#9 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Customer_AccountController->indexAction()
#10 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#11 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /var/www/html/mysite/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#13 /var/www/html/mysite/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /var/www/html/mysite/public_html/index.php(93): Mage::run('', 'store')
#15 {main}

I didn't touch my config.xml nor anything else aside from the two files I already mentioned (and only to remove functionality I didn't want in this particular block) and this is my config.xml:

<?xml version="1.0"?>

                    <invoiced translate="label">
                            <invoced default="1"/>



I've read other threads on this matter here on StackExchange but didn't get any clues to what might be the problem.

So, what am I doing wrong that I can't get my block to render and I'm getting that error on my exceptions.log ? Also, I'm a Magento newb.

3 Answers 3


As per as magento,the file/folder name after Block,Model,Helper folder should be start with Uppercase and only contain one uppercase for each folder and files.

According to magento the file name is Mymenu instead of MyMenu.

Class name should be MyNamespace_CustomerDashboard_Block_Mymenu

  • Well, I must admit I didn't know that nor thought that would be important! Well spotted. The block is now definatly there. No content renders though, but theblock is there.. (can't upvote you yet because of rep :( )
    – Zed_Blade
    Commented Jun 1, 2015 at 1:40
  • Also.need to check class name same as .... Mymenu
    – Amit Bera
    Commented Jun 1, 2015 at 1:42
  • I did that once you mentioned the differences between my style and megento's style. Both on the controller and on the Block. I'm checking into what else might be the problem
    – Zed_Blade
    Commented Jun 1, 2015 at 1:44
  • answer update please check
    – Amit Bera
    Commented Jun 1, 2015 at 6:11
  • very useful answer great :) Commented Nov 23, 2017 at 6:04

Your error says, it cant find the block MyNamespace_CustomerDashboard_Block_Mymenu. As per this hint, Your block class should be at app\code\local\MyNamespace\CustomerDashboard\Block\Mymenu.php. Please note you have MyMenu.php. It should be Mymenu.php. Also you need to ensure the class name is MyNamespace_CustomerDashboard_Block_Mymenu.


you can avoid this error by simply changing your local.xml update. It should look like this.

<reference name="left">
    <block type="customerdashboard/myMenu" name="customerdashboard.mymenu" template="customer/form/my-menu.phtml"/>

See the type now we are using. It is customerdashboard/myMenu instead of customerdashboard/mymenu. Now this type will refer to the block class MyNamespace_CustomerDashboard_Block_MyMenu. This way your block will be recongnized by Magento and problem will resolve

Note : Dont forget to clear the cache.


In some cases (Magento 1.9), if we forgot to use construct function in block PHP file then put it and the issue will be fixed:

 protected function _construct()

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.