Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行cron.PHP时出现Magento PHP致命错误_Magento_Magento 1.6 - Fatal编程技术网

运行cron.PHP时出现Magento PHP致命错误

运行cron.PHP时出现Magento PHP致命错误,magento,magento-1.6,Magento,Magento 1.6,在为Magento webshop运行cron.php时,我看到以下错误: PHP致命错误:对非对象调用成员函数getEvent() 第86行的app/code/core/Mage/CatalogRule/Model/Observer.php中 它是一个Magento 1.6.2网络商店 这是第86行: $product = $observer->getEvent()->getProduct(); 这是出现错误的函数: public function processFront

在为Magento webshop运行cron.php时,我看到以下错误:

PHP致命错误:对非对象调用成员函数getEvent() 第86行的app/code/core/Mage/CatalogRule/Model/Observer.php中

它是一个Magento 1.6.2网络商店

这是第86行:

$product    = $observer->getEvent()->getProduct();
这是出现错误的函数:

public function processFrontFinalPrice($observer)
{
    $product    = $observer->getEvent()->getProduct();
    $pId        = $product->getId();
    $storeId    = $product->getStoreId();

    if ($observer->hasDate()) {
        $date = $observer->getEvent()->getDate();
    } else {
        $date = Mage::app()->getLocale()->storeTimeStamp($storeId);
    }

    if ($observer->hasWebsiteId()) {
        $wId = $observer->getEvent()->getWebsiteId();
    } else {
        $wId = Mage::app()->getStore($storeId)->getWebsiteId();
    }

    if ($observer->hasCustomerGroupId()) {
        $gId = $observer->getEvent()->getCustomerGroupId();
    } elseif ($product->hasCustomerGroupId()) {
        $gId = $product->getCustomerGroupId();
    } else {
        $gId = Mage::getSingleton('customer/session')->getCustomerGroupId();
    }

    $key = "$date|$wId|$gId|$pId";
    if (!isset($this->_rulePrices[$key])) {
        $rulePrice = Mage::getResourceModel('catalogrule/rule')
            ->getRulePrice($date, $wId, $gId, $pId);
        $this->_rulePrices[$key] = $rulePrice;
    }
    if ($this->_rulePrices[$key]!==false) {
        $finalPrice = min($product->getData('final_price'), $this->_rulePrices[$key]);
        $product->setFinalPrice($finalPrice);
    }
    return $this;
}
Magento的核心代码未做任何修改


有人知道出了什么问题吗?

你想抓住什么事件

无论如何,我使用它:
$product\u id=Mage::registry('current\u product')->getId()

它似乎有效。

您是否在
异常.log中有堆栈跟踪?您似乎试图计算最终价格..我在价格事件中看到问题..请检查此。。模块和开发/0-\u模块和开发\u在\u magento中/使用\u事件-观察者\u方法自定义\u magento\u,对此我不确定..但这可能是..您是否在管理中设置了任何目录价格规则?exception.log中未显示任何内容。是的,在管理中设置了目录价格规则。当我禁用目录价格规则时,它工作正常,没有显示错误。我不确定它试图捕获哪个事件。这是一个核心Magento文件。我认为这是目录规则。我不明白你说的“反正我用它”是什么意思