这很明显,因为当您(作为客户)在 PayPal 支付页面取消订单时,它会在重定向到商店之前自动销毁(取消设置)订单和订单报价 - 不要与著名的:Cancelled订单 顾名思义,显示的是实际已完成然后取消的实际订单。
根据您使用的 PayPal 方法,这可能会有所不同。
在标准 PayPal 中,您可以在此控制器中找到它:
\magento\app\code\core\Mage\Paypal\controllers\StandardController.php
当你取消订单时,cancelAction(),它首先取消订单:
public function cancelAction()
{
$session = Mage::getSingleton('checkout/session');
$session->setQuoteId($session->getPaypalStandardQuoteId(true));
if ($session->getLastRealOrderId()) {
$order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
if ($order->getId()) {
$order->cancel()->save();
}
Mage::helper('paypal/checkout')->restoreQuote();
}
$this->_redirect('checkout/cart');
}
然后redirectAction() 在重定向回购物车页面之前取消设置报价:
public function redirectAction()
{
$session = Mage::getSingleton('checkout/session');
$session->setPaypalStandardQuoteId($session->getQuoteId());
$this->getResponse()->setBody($this->getLayout()->createBlock('paypal/standard_redirect')->toHtml());
$session->unsQuoteId();
$session->unsRedirectUrl();
}
另一方面,在 PayPal Express 中,在此控制器中触发取消操作:
\app\code\core\Mage\Paypal\Controller\Express\Abstract.php
public function cancelAction()
{
try {
$this->_initToken(false);
// TODO verify if this logic of order cancelation is deprecated
// if there is an order - cancel it
$orderId = $this->_getCheckoutSession()->getLastOrderId();
$order = ($orderId) ? Mage::getModel('sales/order')->load($orderId) : false;
if ($order && $order->getId() && $order->getQuoteId() == $this->_getCheckoutSession()->getQuoteId()) {
$order->cancel()->save();
$this->_getCheckoutSession()
->unsLastQuoteId()
->unsLastSuccessQuoteId()
->unsLastOrderId()
->unsLastRealOrderId()
->addSuccess($this->__('Express Checkout and Order have been canceled.'))
;
} else {
$this->_getCheckoutSession()->addSuccess($this->__('Express Checkout has been canceled.'));
}
} catch (Mage_Core_Exception $e) {
$this->_getCheckoutSession()->addError($e->getMessage());
} catch (Exception $e) {
$this->_getCheckoutSession()->addError($this->__('Unable to cancel Express Checkout.'));
Mage::logException($e);
}
$this->_redirect('checkout/cart');
}
它在同一个地方取消了所有东西。
因此,在您的情况下,如果您需要保留报价(我想这是您在自定义模块中一直在利用的),您必须更改 PayPal 模块的这种行为。
请记住,如果您要这样做,请不要修改原始核心文件,而是在您的自定义模块中扩展这些类并在那里应用您的更改。