Skip to content

Commit 7fe9909

Browse files
committed
ACP2E-860: The attribute values are storing correctly only if it's 'Show Company' property is 'Optional' for 'Main Website' for Multistore
- Fixed the issue.
1 parent df0f32a commit 7fe9909

File tree

2 files changed

+15
-41
lines changed

2 files changed

+15
-41
lines changed

app/code/Magento/Sales/Controller/Adminhtml/Order/Create/LoadBlock.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
use Magento\Backend\App\Action;
1111
use Magento\Backend\Model\View\Result\ForwardFactory;
1212
use Magento\Framework\View\Result\PageFactory;
13+
use Magento\Framework\App\ObjectManager;
1314
use Magento\Framework\Controller\Result\RawFactory;
1415
use Magento\Sales\Controller\Adminhtml\Order\Create as CreateAction;
16+
use Magento\Store\Model\StoreManagerInterface;
1517

1618
class LoadBlock extends CreateAction implements HttpPostActionInterface, HttpGetActionInterface
1719
{
@@ -20,21 +22,28 @@ class LoadBlock extends CreateAction implements HttpPostActionInterface, HttpGet
2022
*/
2123
protected $resultRawFactory;
2224

25+
/**
26+
* @var StoreManagerInterface
27+
*/
28+
private $storeManager;
29+
2330
/**
2431
* @param Action\Context $context
2532
* @param \Magento\Catalog\Helper\Product $productHelper
2633
* @param \Magento\Framework\Escaper $escaper
2734
* @param PageFactory $resultPageFactory
2835
* @param ForwardFactory $resultForwardFactory
2936
* @param RawFactory $resultRawFactory
37+
* @param StoreManagerInterface|null $storeManager
3038
*/
3139
public function __construct(
3240
Action\Context $context,
3341
\Magento\Catalog\Helper\Product $productHelper,
3442
\Magento\Framework\Escaper $escaper,
3543
PageFactory $resultPageFactory,
3644
ForwardFactory $resultForwardFactory,
37-
RawFactory $resultRawFactory
45+
RawFactory $resultRawFactory,
46+
StoreManagerInterface $storeManager = null
3847
) {
3948
$this->resultRawFactory = $resultRawFactory;
4049
parent::__construct(
@@ -44,6 +53,8 @@ public function __construct(
4453
$resultPageFactory,
4554
$resultForwardFactory
4655
);
56+
$this->storeManager = $storeManager ?: ObjectManager::getInstance()
57+
->get(StoreManagerInterface::class);
4758
}
4859

4960
/**
@@ -54,6 +65,9 @@ public function __construct(
5465
public function execute()
5566
{
5667
$request = $this->getRequest();
68+
if ($request->getParam('store_id') !== 'false') {
69+
$this->storeManager->setCurrentStore($request->getParam('store_id'));
70+
}
5771
try {
5872
$this->_initSession()->_processData();
5973
} catch (\Magento\Framework\Exception\LocalizedException $e) {

app/code/Magento/Sales/Controller/Adminhtml/Order/Create/Save.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,11 @@
66

77
namespace 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;
129
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
13-
use Magento\Framework\App\ObjectManager;
14-
use Magento\Framework\Escaper;
1510
use Magento\Framework\Exception\PaymentException;
16-
use Magento\Framework\View\Result\PageFactory;
17-
use Magento\Store\Model\StoreManagerInterface;
1811

1912
class Save extends \Magento\Sales\Controller\Adminhtml\Order\Create implements HttpPostActionInterface
2013
{
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-
5314
/**
5415
* Saving quote and create order
5516
*
@@ -70,7 +31,6 @@ public function execute()
7031
) {
7132
return $this->resultForwardFactory->create()->forward('denied');
7233
}
73-
$this->storeManager->setCurrentStore($this->_getSession()->getQuote()->getStore()->getCode());
7434
$this->_getOrderCreateModel()->getQuote()->setCustomerId($this->_getSession()->getCustomerId());
7535
$this->_processActionData('save');
7636
$paymentData = $this->getRequest()->getPost('payment');

0 commit comments

Comments
 (0)