【问题标题】:Magento Error - Invalid block typeMagento 错误 - 块类型无效
【发布时间】:2016-02-25 22:11:59
【问题描述】:

我已将 magento 网站从一台服务器 http://example_old.com/ 移动到另一台服务器 http://example.com/beta/。但是在类别/产品列表页面上不显示,只出现空白屏幕。检查错误日志时显示以下错误:

exception 'Mage_Core_Exception' with message 'Invalid block type: Mage_Page_Block_Header' in /var/www/vhosts/example.com/httpdocs/beta/app/Mage.php:595
Stack trace:
#0 /var/www/vhosts/example.com/httpdocs/beta/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /var/www/vhosts/example.com/httpdocs/beta/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('page/header', Array)
#2 /var/www/vhosts/example.com/httpdocs/beta/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('page/header', 'header')
#3 /var/www/vhosts/example.com/httpdocs/beta/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('page/header', 'header')

同样的空白屏幕出现在管理面板上。

这个错误的原因是什么?在旧服务器上它工作正常。

提前致谢。

【问题讨论】:

    标签: php magento server


    【解决方案1】:

    我知道这是 6 个月后的事,但如果您仍然需要,我有一个解决方案。

    我遇到了类似的问题。我将补丁安装到我的 1.9.2.1 安装中,然后突然我的产品列表页面是空白的。 像你一样,我去了日志,看到了那个错误。但我觉得这个错误与您所拥有的空白产品列表页面松散相关。

    为了处理这个错误,我访问了我的布局文件,我引用了标题,然后将其作为子块加载:

    <reference name="header">
            <block type="page/header" name="header">
                <action method="setTemplate">
                    ...
    

    当我需要做的只是引用它时,我删除了该块:

    <reference name="header">
            <action method="setTemplate">
    

    这解决了错误日志,但不是空白产品列表页面。我不确定您运行的是哪个版本的 Magento,但我了解到人们在 1.9.2.2 版中遇到了静态块短代码问题see here for details

    如果您在类别中使用静态块

    我在某些类别中使用静态块简码。要解决这个问题(正如 dudesjoerd 从上述文章中指出的那样),您必须前往 System > Permissions > Blocks:并允许您使用的任何块类型(如果有)

    如果您没有在类别中使用静态块

    由于您是从服务器迁移到服务器而不是应用补丁,我只能建议您的 PHP 版本不同,并且您的产品列表 phtml 文件中存在版本错误。

    希望对你有帮助!

    【讨论】:

    • @Chirs Rogers:当管理员编辑任何可配置的产品时,就会出现这个异常。如何解决它有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 2012-08-19
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 2015-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多