开发者

Weird Error In My system.log file Over and Over and Over

开发者 https://www.devze.com 2023-02-07 16:14 出处:网络
In Magento Enterprise 1.8 I am getting a particular error over and over again and I was wondering if someone else has had this problem and what they did to solve it.

In Magento Enterprise 1.8 I am getting a particular error over and over again and I was wondering if someone else has had this problem and what they did to solve it.

The error is:

Invalid block type: Mage_CatalogInventory_Block_Qt开发者_开发问答yincrements

I am also seeing a lot of there:

Invalid block type: Mage_Navadmin_Block_Navadmin


There are some patch files on this page which fix the Qtyincrements message:
http://www.magentocommerce.com/boards/viewthread/195761/P0/


When you attempt to instantiate a block object, if Magento can't find the class it will log the error, not render the block, and move along.

This happens in a few places throughout the code base, but the most likely place is in

File: app/code/core/Mage/Core/Model/Layout.php
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;
}
//...
public function getBlockSingleton($type)
{
    if (!isset($this->_helpers[$type])) {
        $className = Mage::getConfig()->getBlockClassName($type);
        if (!$className) {
            Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $type));
        }

        $helper = new $className();
        if ($helper) {
            if ($helper instanceof Mage_Core_Block_Abstract) {
                $helper->setLayout($this);
            }
            $this->_helpers[$type] = $helper;
        }
    }
    return $this->_helpers[$type];
}

So, your two specific errors. Magento can't instantiate a

Mage_CatalogInventory_Block_Qtyincrements

That's probably because in the layout that ships with 1.8 the core code tried to use a block that would instantiate a

<block type="cataloginventory/qtyincrements" name="product.info.extrahint" as="extrahint" template="cataloginventory/qtyincrements.phtml"/>

This is a 1.8 bug. I'd contact Magento Enterprise support for a patch. As mentioned by @clockworkgeek it looks like the community edition suffered a similar problem. The patch in that thread is worth looking at for a fix, but I'd be wary of applying a patch meant for Enterprise Edition to Community Edition.

In your second error, Magento can't instantiate a

Mage_Navadmin_Block_Navadmin

There is no Navadmin module that ships with Enterprise 1.8. Based on the block name, that means there's probably some block XML somewhere that looks something like

<block type="navadmin/navadmin"

My best guess if someone, at some point, installed this extension on your site. It's supposed to install files to (among other places)

app/code/community/Mage/Navadmin

Templates or XML layout files that reference the block are likely left on your system, but the actual class file that defines the block in

app/code/community/Mage/Navadmin/Block/Navadmin.php

is missing.


I only find references to 'Invalid block type' in Mage_Core_Model_Layout::_getBlockInstance().

The error seems to be caused either when a block does not inherit from Mage_Core_Block_Abstract or the block cannot be loaded by it's short format due to a lacking in the appropriate config.xml file somewhere.

  • Do the classes actually exist on your system?
  • What elements are using them in the layout/*.xml files?
  • Is there something up, like a syntax error, with the config.xml in Mage/{Navadmin,CatalogInventory}/etc/config.xml? (configuration file locations are an educated guess)
0

精彩评论

暂无评论...
验证码 换一张
取 消