Skip to content

Commit 0663608

Browse files
committed
MAGETWO-38779: Stabilize story
1 parent 9cda981 commit 0663608

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

app/code/Magento/Checkout/Block/Onepage/Success.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ protected function _prepareLastOrder()
104104
{
105105
$orderId = $this->_checkoutSession->getLastOrderId();
106106
if ($orderId) {
107-
$order = $this->_orderFactory->create()->load($orderId);
108-
if ($order->getId()) {
109-
$isVisible = !in_array($order->getStatus(), $this->_orderConfig->getInvisibleOnFrontStatuses());
107+
$incrementId = $this->_checkoutSession->getLastRealOrderId();
108+
$status = $this->_checkoutSession->getLastOrderStatus();
109+
if ($status && $incrementId) {
110+
$isVisible = !in_array($status, $this->_orderConfig->getInvisibleOnFrontStatuses());
110111
$canView = $this->httpContext->getValue(Context::CONTEXT_AUTH) && $isVisible;
111112
$this->addData(
112113
[
@@ -115,7 +116,7 @@ protected function _prepareLastOrder()
115116
'print_url' => $this->getUrl('sales/order/print', ['order_id' => $orderId]),
116117
'can_print_order' => $isVisible,
117118
'can_view_order' => $canView,
118-
'order_id' => $order->getIncrementId(),
119+
'order_id' => $incrementId,
119120
]
120121
);
121122
}

app/code/Magento/Checkout/Model/Type/Onepage.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,14 +983,18 @@ public function saveOrder()
983983
$redirectUrl
984984
)->setLastRealOrderId(
985985
$order->getIncrementId()
986+
)->setLastOrderStatus(
987+
$order->getStatus()
986988
);
987989
}
988990

989991
$this->_eventManager->dispatch(
990992
'checkout_submit_all_after',
991-
['order' => $order, 'quote' => $this->getQuote()]
993+
[
994+
'order' => $order,
995+
'quote' => $this->getQuote()
996+
]
992997
);
993-
994998
return $this;
995999
}
9961000

app/code/Magento/Quote/Model/QuoteManagement.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ public function placeOrder($cartId, $agreements = null, PaymentInterface $paymen
333333
$this->checkoutSession->setLastSuccessQuoteId($quote->getId());
334334
$this->checkoutSession->setLastOrderId($order->getId());
335335
$this->checkoutSession->setLastRealOrderId($order->getIncrementId());
336+
$this->checkoutSession->setLastOrderStatus($order->getStatus());
336337

337338
$this->eventManager->dispatch('checkout_submit_all_after', ['order' => $order, 'quote' => $quote]);
338339
return $order->getId();

0 commit comments

Comments
 (0)