致命错误:在第80行的app / code / core / Mage / Adminhtml / Block / Page / Menu.php中的非对象上调用成员函数getId()

时间:2013-03-22 08:19:39

标签: magento

我为管理员安装了一个主题。刷新缓存,看起来很棒。我注销并重新登录并收到以下错误:

 Fatal error: Call to a member function getId() on a non-object in app/code/core/Mage/Adminhtml/Block/Page/Menu.php on line 80

第65-89行:

public function getCacheLifetime()
{
    return 86400;
}

/**
 * Get Key pieces for caching block content
 *
 * @return array
 */
public function getCacheKeyInfo()
{
    $cacheKeyInfo = array(
        'admin_top_nav',
        $this->getActive(),
        Mage::getSingleton('admin/session')->getUser()->getId(),
        Mage::app()->getLocale()->getLocaleCode()
    );
    // Add additional key parameters if needed /
    $additionalCacheKeyInfo = $this->getAdditionalCacheKeyInfo();
    if (is_array($additionalCacheKeyInfo) && !empty($additionalCacheKeyInfo)) {
        $cacheKeyInfo = array_merge($cacheKeyInfo, $additionalCacheKeyInfo);
    }
    return $cacheKeyInfo;
}

如何解决此问题?

1 个答案:

答案 0 :(得分:1)

请尝试Mage::getSingleton('admin/session')->getUser()->getUserId()