0

I'm getting the following errors in my exception.log:

exception 'Mage_Core_Exception' with message 'Invalid block type: Mage__Block_Catalog' in /var/www/vhosts/my.websiteaddress.com/httpdocs/app/Mage.php:594 Stack trace: /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...') /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('/catalog/produc...', Array) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('/catalog/produc...', 'product_list') /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('/catalog/produc...', 'product_list') /var/www/vhosts/my.websiteaddress.com/httpdocs/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)) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element)) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks() /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Catalog/controllers/CategoryController.php(146): Mage_Core_Controller_Varien_Action->generateLayoutBlocks() /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Catalog_CategoryController->viewAction() /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view') /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/community/ArtsOnIT/OfflineMaintenance/Controller/Router/Standard.php(46): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(176): ArtsOnIT_OfflineMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) /var/www/vhosts/my.websiteaddress.com/httpdocs/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() /var/www/vhosts/my.websiteaddress.com/httpdocs/app/Mage.php(683): Mage_Core_Model_App->run(Array) /var/www/vhosts/my.websiteaddress.com/httpdocs/index.php(137): Mage::run('uk', 'website')

So it looks like the module name isn't being declared, hence the double underscore: Invalid block type: Mage__Block_Catalog

So my question is, where can I find to add in the module name for this?

closed as off-topic by David Manners, Keyul Shah, Marius Feb 15 '15 at 7:25

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on problems in code you've written must describe the specific problem and include valid code to reproduce it. For help writing short, self-contained syntactically-valid examples, see: http://sscce.org/" – David Manners, Keyul Shah, Marius
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Search for type="/catalog" in files app/design/frontend/**/*.xml – Fabian Schmengler Feb 15 '15 at 8:12
1

Invalid Block Type Exception is arised by Mage_Core_Model_Layout::_getBlockInstance() which will be called by the method Mage_Core_Model_Layout::createBlock(). This is how _getBlockInstance look like

protected function _getBlockInstance($block, array $attributes=array())
{
    if (is_string($block)) {
        if (strpos($block, '/')!==false) {
            if (!$block = Mage::getConfig()->getBlockClassName($block)) {
                Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
            }
        }
        if (class_exists($block, false) || mageFindClassFile($block)) {
            $block = new $block($attributes);
        }
    }
    if (!$block instanceof Mage_Core_Block_Abstract) {
        Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
    }
    return $block;
}

Now we can go through the method by using the invalid block type in this case. Here the invalid block type is Mage__Block_Catalog. So there are two possibility here.

1. Somewhere in your application, you are passing a block type value Mage__Block_Catalog to the createBlock() method.

if that is the case, then this is the part which generates the exception

    if (!$block instanceof Mage_Core_Block_Abstract) {
        Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
    }

This is because Mage__Block_Catalog is not a valid block class and really does not exist.

The probability for the occurance of this chance is too less.

2. Somewhere in your application, you are trying to create a block which is passed in this format /catalog.

In thi case, $block = Mage::getConfig()->getBlockClassName($block) will look like $block = Mage::getConfig()->getBlockClassName('/catalog') and hence the method return a value Mage__Block_Catalog and hence

 $block =  Mage__Block_Catalog

Since such a block is invalid as I stated in the first case, the method will arise an exception

My assumption is that, this is what that makes problem in your case. Somewhere in your application you have edited the core code (may be in layout xml file) and thus block type become /catalog instead of catalog/catalog (This will return a class Mage_Catalog_Block_Catalog). You need to find it and resolce it.

Not the answer you're looking for? Browse other questions tagged or ask your own question.