Success page redirection issue
-
14-04-2021 - |
题
$this->checkoutSession->getLastSuccessQuoteId()
$this->checkoutSession->getLastQuoteId()
$this->checkoutSession->getLastOrderId()
These things always returns false after payment success, so i always redirect to cart page. I search over the google and every where but not found helpful. My model file is:
vendor/magento/module-checkout/Model/Session/SuccessValidator.php
public function isValid()
{
if (!$this->checkoutSession->getLastSuccessQuoteId()) {
return false;
}
if (!$this->checkoutSession->getLastQuoteId() || !$this->checkoutSession->getLastOrderId()) {
return false;
}
return true;
}
解决方案
After my research i have made solution for this. I made changes in Payment gateway Controller/Response.php
.
I have added the following code just after "Success" response.
$this->_checkoutSession->setLastOrderId($order->getId());
$this->_checkoutSession->setLastQuoteId($order->getQuoteId());
$this->_checkoutSession->setLastSuccessQuoteId($order->getQuoteId());
Issue Solved!
其他提示
Try this code may be it will help you.
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setPath('checkout/onepage/successs');
return $resultRedirect;
Thanks