6
6
7
7
namespace Magento \Sales \Controller \Adminhtml \Order \Create ;
8
8
9
+ use Magento \Backend \App \Action \Context ;
10
+ use Magento \Backend \Model \View \Result \ForwardFactory ;
11
+ use Magento \Catalog \Helper \Product ;
9
12
use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
13
+ use Magento \Framework \App \ObjectManager ;
14
+ use Magento \Framework \Escaper ;
10
15
use Magento \Framework \Exception \PaymentException ;
16
+ use Magento \Framework \View \Result \PageFactory ;
17
+ use Magento \Store \Model \StoreManagerInterface ;
11
18
12
19
class Save extends \Magento \Sales \Controller \Adminhtml \Order \Create implements HttpPostActionInterface
13
20
{
21
+ /**
22
+ * @var StoreManagerInterface
23
+ */
24
+ private $ storeManager ;
25
+
26
+ /**
27
+ * @param Context $context
28
+ * @param Product $productHelper
29
+ * @param Escaper $escaper
30
+ * @param PageFactory $resultPageFactory
31
+ * @param ForwardFactory $resultForwardFactory
32
+ * @param StoreManagerInterface|null $storeManager
33
+ */
34
+ public function __construct (
35
+ Context $ context ,
36
+ Product $ productHelper ,
37
+ Escaper $ escaper ,
38
+ PageFactory $ resultPageFactory ,
39
+ ForwardFactory $ resultForwardFactory ,
40
+ StoreManagerInterface $ storeManager = null
41
+ ) {
42
+ parent ::__construct (
43
+ $ context ,
44
+ $ productHelper ,
45
+ $ escaper ,
46
+ $ resultPageFactory ,
47
+ $ resultForwardFactory
48
+ );
49
+ $ this ->storeManager = $ storeManager ?: ObjectManager::getInstance ()
50
+ ->get (StoreManagerInterface::class);
51
+ }
52
+
14
53
/**
15
54
* Saving quote and create order
16
55
*
@@ -31,6 +70,7 @@ public function execute()
31
70
) {
32
71
return $ this ->resultForwardFactory ->create ()->forward ('denied ' );
33
72
}
73
+ $ this ->storeManager ->setCurrentStore ($ this ->_getSession ()->getQuote ()->getStore ()->getCode ());
34
74
$ this ->_getOrderCreateModel ()->getQuote ()->setCustomerId ($ this ->_getSession ()->getCustomerId ());
35
75
$ this ->_processActionData ('save ' );
36
76
$ paymentData = $ this ->getRequest ()->getPost ('payment ' );
0 commit comments