【问题标题】:Cancelled Paypal orders not showing in Magento adminMagento admin 中未显示已取消的 Paypal 订单
【发布时间】:2015-09-29 04:27:56
【问题描述】:

我已经配置了一个 Magento 1.9 社区商店,所有通过 Paypal 或其他付款方式(如货到付款)付款的订单都显示在后端。

但是,当我选择 Paypal 作为网关结账时,在 Paypal 页面上取消我的订单并返回网站 - 我的订单没有显示在管理中。不是应该显示为已取消的订单吗?

由于这是从 Shopify 迁移而来的商店,我们不得不手动创建大约 100 个订单并手动更改数据库中的日期。这可能是导致这种意外行为的原因吗?

编辑 1:即使关闭了 paypal 窗口而不是像许多答案所建议的那样单击取消,网格中也不会显示订单信息。

【问题讨论】:

  • 一旦你取消它?客户的购物车中有产品吗?如果是,则未下订单。
  • 由您不需要手动创建订单。您可以导入订单
  • 是的,但是通过我自己的代码使用自定义支付网关解决方案 - 只要客户离开我的网站并进入支付网关的网站,就会在网格中创建一个订单。如果他完成交易,我将得到处理,否则我将作为订单状态等待处理。但是,对于 Paypal,订单只有在订单成功时才会显示。如果有人取消或关闭 Paypal 页面上的窗口,我将在订单列表中一无所获。

标签: magento paypal


【解决方案1】:

这很明显,因为当您(作为客户)在 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 模块的这种行为。

请记住,如果您要这样做,请不要修改原始核心文件,而是在您的自定义模块中扩展这些类并在那里应用您的更改。

【讨论】:

  • 从您的回答中我了解到,如果在到达贝宝付款页面时窗口关闭而不是单击取消,则订单应显示在订单网格中。但是,即使在这种情况下,我也没有在我的网格中获得具有待处理状态的订单。我正在使用快速结帐选项。
  • 此外,大多数购物车都有这样的功能,即向客户发送 2-3 封电子邮件用于“放弃结账”。如果没有此类订单的信息,Magento 如何处理废弃的结账。
  • @SarthakGupta 实际上在它进入 sales_flat_order 表之前您无法在网格中看到它;在此之前(虽然它仍然是报价,或者说仍在购物车中更好)它保存在 sales_flat_quote 表中。收到成功消息后,Magento 调度一个事件以将报价转换为订单:Mage::dispatchEvent('sales_convert_quote_to_order', array('order'=>$order, 'quote'=>$quote));
【解决方案2】:

当您在未完成付款的情况下从 Paypal 页面取消订单时,它会将您重定向回您的购物车页面。不会下订单。

如果您在 paypal 重定向后关闭页面,但未完成付款(请注意,您不必在此处按取消)订单将处于待付款状态。

要验证 paypal 是否正常工作,请尝试通过 paypal 完成付款过程。如果您将其用于测试目的,您可以使用沙盒模式,这样您就不会为您的订单付费。

希望这会有所帮助!

【讨论】:

  • 通过在 Paypal 页面上关闭窗口一次来检查它 - 但是订单信息不会显示在管理员的“订单”部分中。
猜你喜欢
  • 2011-06-01
  • 1970-01-01
  • 2014-04-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-18
  • 2020-11-11
  • 2019-07-25
相关资源
最近更新 更多