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