致命错误:调用未定义的方法Mage_Sales_Model_Resource_Order_Status_Collection :: addStatusFilter()

时间:2015-07-01 11:39:18

标签: php magento

我在我的网站上使用财务支付模块,在向金融网站下订单后重定向用户以填写他们的详细信息。

我刚刚从Magestore安装了“一步结账”并测试订单周期以确保它像以前一样工作,但事实并非如此。

下订单后,我在标题中得到错误

它告诉我StatusUpdate.php第20行有错误,下面是该文件的代码。

谁能告诉我发生了什么事? Screengrab of error

<?php
class C3_V12Finance_Helper_StatusUpdate extends Mage_Core_Helper_Abstract
{
public function handleOrderStatusUpdate(Mage_Sales_Model_Order $order, $configPath) {
    if ($status = Mage::getStoreConfig($configPath)) {
        $state = $this->getStateFromStatus($status);
        /* Magento doesn't allow some states to be changed manually ('complete' and 'closed'). This validation only
         * occurs however when you change state via setState. The validation doesn't occur on setData, however so
         * we use this as a workaround. */
        $order->setData('state', $state)
            ->setStatus($status)
            ->save();
        return true;
    }
    return false;
}

public function getStateFromStatus($status) {
    $collection = Mage::getResourceModel('sales/order_status_collection')
        ->addStatusFilter($status)
        ->joinStates();

    // Magento will actually prevent you from ever being able to have multiple statuses with the same code, but just to be safe...
    if ($collection->getSize() > 1) {
        Mage::throwException("Multiple statuses found with code " . $status . ". Ensure only one is present.");
    }

    $statusModel = $collection->getFirstItem();
    return $statusModel->getState();
}
}

0 个答案:

没有答案