Success.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Multishipping\Controller\Checkout;
  8. use Magento\Framework\App\Action\Action;
  9. use Magento\Framework\App\Action\Context;
  10. use Magento\Multishipping\Model\Checkout\Type\Multishipping;
  11. use Magento\Multishipping\Model\Checkout\Type\Multishipping\State;
  12. /**
  13. * Multishipping checkout success controller.
  14. */
  15. class Success extends Action
  16. {
  17. /**
  18. * @var State
  19. */
  20. private $state;
  21. /**
  22. * @var Multishipping
  23. */
  24. private $multishipping;
  25. /**
  26. * @param Context $context
  27. * @param State $state
  28. * @param Multishipping $multishipping
  29. */
  30. public function __construct(
  31. Context $context,
  32. State $state,
  33. Multishipping $multishipping
  34. ) {
  35. $this->state = $state;
  36. $this->multishipping = $multishipping;
  37. parent::__construct($context);
  38. }
  39. /**
  40. * Multishipping checkout success page
  41. *
  42. * @return void
  43. */
  44. public function execute()
  45. {
  46. if (!$this->state->getCompleteStep(State::STEP_OVERVIEW)) {
  47. $this->_redirect('*/*/addresses');
  48. return;
  49. }
  50. $this->_view->loadLayout();
  51. $ids = $this->multishipping->getOrderIds();
  52. $this->_eventManager->dispatch('multishipping_checkout_controller_success_action', ['order_ids' => $ids]);
  53. $this->_view->renderLayout();
  54. }
  55. }