Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/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
在core magento中重写类_Magento - Fatal编程技术网

在core magento中重写类

在core magento中重写类,magento,Magento,我需要覆盖Mage_Paypal_Model_Ipn类 class Budsies_Budsie_Paypal_Model_Ipn extends Mage_Paypal_Model_Ipn { protected function _processOrder() { Mage::log('Budsies_Budsie_Paypal_Model_Ipn', null, 'processOrder.log'); $orderState = $thi

我需要覆盖Mage_Paypal_Model_Ipn类

class Budsies_Budsie_Paypal_Model_Ipn extends  Mage_Paypal_Model_Ipn
{
    protected function _processOrder()
    {
        Mage::log('Budsies_Budsie_Paypal_Model_Ipn', null, 'processOrder.log');
        $orderState = $this->_order->getState();
        if ($orderState != Mage_Sales_Model_Order::STATE_COMPLETE &&
                   $orderState != Mage_Sales_Model_Order::STATE_HOLDED) {
            parent::_processOrder();
        }
    }
}
我将config.xml添加到我的模块全局部分:

  <global>
    <models>
        <paypal>
            <rewrite>
                <ipn>Budsies_Budsie_Paypal_Model_Ipn</ipn>
            </rewrite>
        </paypal>
    </models>
  </global>

Budsies_Budsie_Paypal_Model_Ipn
但它不起作用。配置文件应该是什么,以使我的类重写核心类。你能告诉我有什么问题吗

我纠正了它,只是这一部分更大,我做了复制粘贴。但它不起作用


谢谢你的帮助。我的重写很有效。问题是该帐户的ipn没有配置,没有ipn,因此没有调用此方法。

如果您的XML确实是这样的,那么它是这样的:

<global>
  <models>
      <paypal>
          <rewrite>
              <ipn>Budsies_Budsie_Paypal_Model_Ipn</ipn>
          </rewrite>
      </paypal>
  </models>
</global>

Budsies_Budsie_Paypal_Model_Ipn

您在那里有两次
,并且没有关闭
标记。

您的覆盖现在看起来是正确的。确保清除所有缓存。您应该在系统->配置->高级->高级中看到您的模块。如果您发布整个config.xml文件以防万一,可能会有所帮助。您可以发布整个xml配置吗?