66
77namespace Magento \Sales \Controller \Adminhtml \Order \Create ;
88
9+ use Magento \Backend \App \Action \Context ;
10+ use Magento \Backend \Model \View \Result \ForwardFactory ;
11+ use Magento \Catalog \Helper \Product ;
912use Magento \Framework \App \Action \HttpPostActionInterface as HttpPostActionInterface ;
13+ use Magento \Framework \App \ObjectManager ;
14+ use Magento \Framework \Escaper ;
1015use Magento \Framework \Exception \PaymentException ;
16+ use Magento \Framework \View \Result \PageFactory ;
17+ use Magento \Store \Model \StoreManagerInterface ;
1118
1219class Save extends \Magento \Sales \Controller \Adminhtml \Order \Create implements HttpPostActionInterface
1320{
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+
1453 /**
1554 * Saving quote and create order
1655 *
@@ -31,6 +70,7 @@ public function execute()
3170 ) {
3271 return $ this ->resultForwardFactory ->create ()->forward ('denied ' );
3372 }
73+ $ this ->storeManager ->setCurrentStore ($ this ->_getSession ()->getQuote ()->getStore ()->getCode ());
3474 $ this ->_getOrderCreateModel ()->getQuote ()->setCustomerId ($ this ->_getSession ()->getCustomerId ());
3575 $ this ->_processActionData ('save ' );
3676 $ paymentData = $ this ->getRequest ()->getPost ('payment ' );
0 commit comments