Failure.php 722 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Checkout\Controller\Onepage;
  8. class Failure extends \Magento\Checkout\Controller\Onepage
  9. {
  10. /**
  11. * @return \Magento\Framework\View\Result\Page|\Magento\Framework\Controller\Result\Redirect
  12. */
  13. public function execute()
  14. {
  15. $lastQuoteId = $this->getOnepage()->getCheckout()->getLastQuoteId();
  16. $lastOrderId = $this->getOnepage()->getCheckout()->getLastOrderId();
  17. if (!$lastQuoteId || !$lastOrderId) {
  18. return $this->resultRedirectFactory->create()->setPath('checkout/cart');
  19. }
  20. return $this->resultPageFactory->create();
  21. }
  22. }