Skip to content

Commit 016ffbc

Browse files
committed
ACP2E-778: REST API: Product names in cart always use default store view values
1 parent a8199e6 commit 016ffbc

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

app/code/Magento/Quote/Model/Quote/Plugin/UpdateQuoteStoreId.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ class UpdateQuoteStoreId
2525
/**
2626
* @var StoreCodeInRequestPathInterface
2727
*/
28-
private $storeCoeInRequestPath;
28+
private $storeCodeInRequestPath;
2929

3030
/**
3131
* @param StoreManagerInterface $storeManager
3232
* @param StoreCodeInRequestPathInterface $storeCoeInRequestPath
3333
*/
3434
public function __construct(
3535
StoreManagerInterface $storeManager,
36-
StoreCodeInRequestPathInterface $storeCoeInRequestPath
36+
StoreCodeInRequestPathInterface $storeCodeInRequestPath
3737
) {
3838
$this->storeManager = $storeManager;
39-
$this->storeCoeInRequestPath = $storeCoeInRequestPath;
39+
$this->storeCodeInRequestPath = $storeCodeInRequestPath;
4040
}
4141

4242
/**
@@ -50,7 +50,7 @@ public function __construct(
5050
*/
5151
public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
5252
{
53-
if ($this->storeCoeInRequestPath->hasStoreCodeInRequestPath()) {
53+
if ($this->storeCodeInRequestPath->hasStoreCodeInRequestPath()) {
5454
$storeId = $this->storeManager->getStore()->getId();
5555
if ((int)$storeId !== $result->getStoreId()) {
5656
$result->setStoreId($storeId);
@@ -71,7 +71,7 @@ public function afterLoadByIdWithoutStore(Quote $subject, Quote $result): Quote
7171
*/
7272
public function afterLoadByCustomer(Quote $subject, Quote $result): Quote
7373
{
74-
if ($this->storeCoeInRequestPath->hasStoreCodeInRequestPath()) {
74+
if ($this->storeCodeInRequestPath->hasStoreCodeInRequestPath()) {
7575
$storeId = $this->storeManager->getStore()->getId();
7676
if ((int)$storeId !== $result->getStoreId()) {
7777
$result->setStoreId($storeId);

app/code/Magento/Webapi/Controller/PathProcessor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\Store\Model\StoreManagerInterface;
1414

1515
/**
16-
* Class PathProcessor
16+
* Class PathProcessor to resolve the request path
1717
*/
1818
class PathProcessor
1919
{
@@ -33,23 +33,23 @@ class PathProcessor
3333
/**
3434
* @var StoreCodeInRequestPathInterface
3535
*/
36-
private $storeCoeInRequestPath;
36+
private $storeCodeInRequestPath;
3737

3838
/**
3939
* @param StoreManagerInterface $storeManager
4040
* @param ResolverInterface|null $localeResolver
41-
* @param StoreCodeInRequestPathInterface|null $storeCoeInRequestPath
41+
* @param StoreCodeInRequestPathInterface|null $storeCodeInRequestPath
4242
*/
4343
public function __construct(
4444
StoreManagerInterface $storeManager,
4545
ResolverInterface $localeResolver = null,
46-
?StoreCodeInRequestPathInterface $storeCoeInRequestPath = null
46+
?StoreCodeInRequestPathInterface $storeCodeInRequestPath = null
4747
) {
4848
$this->storeManager = $storeManager;
4949
$this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(
5050
ResolverInterface::class
5151
);
52-
$this->storeCoeInRequestPath = $storeCoeInRequestPath ?: ObjectManager::getInstance()->get(
52+
$this->storeCodeInRequestPath = $storeCodeInRequestPath ?: ObjectManager::getInstance()->get(
5353
StoreCodeInRequestPathInterface::class
5454
);
5555
}
@@ -81,7 +81,7 @@ public function process($pathInfo)
8181
$storeCode = current($pathParts);
8282
$stores = $this->storeManager->getStores(false, true);
8383
if (isset($stores[$storeCode])) {
84-
$this->storeCoeInRequestPath->setStoreCodeInRequestPath(true);
84+
$this->storeCodeInRequestPath->setStoreCodeInRequestPath(true);
8585
$this->storeManager->setCurrentStore($storeCode);
8686
$this->localeResolver->emulate($this->storeManager->getStore()->getId());
8787
$path = '/' . ($pathParts[1] ?? '');

app/code/Magento/Webapi/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@
6666
<argument name="fileName" xsi:type="string">webapi.xml</argument>
6767
</arguments>
6868
</type>
69+
<preference for="Magento\Store\Model\StoreCodeInRequestPathInterface" type="Magento\Store\Model\StoreCodeInRequestPath" />
6970
</config>

app/code/Magento/Webapi/etc/webapi_rest/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,4 @@
8383
<type name="Magento\Store\Model\Validation\StoreCodeValidator">
8484
<plugin name="check_if_parsed_store_code_is_valid" type="Magento\Webapi\Model\Plugin\Store\Model\Validation\StoreCodeValidator"/>
8585
</type>
86-
<preference for="Magento\Store\Model\StoreCodeInRequestPathInterface" type="Magento\Store\Model\StoreCodeInRequestPath" />
8786
</config>

app/code/Magento/Webapi/etc/webapi_soap/di.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,4 @@
6565
<type name="Magento\Store\Model\Validation\StoreCodeValidator">
6666
<plugin name="check_if_parsed_store_code_is_valid" type="Magento\Webapi\Model\Plugin\Store\Model\Validation\StoreCodeValidator"/>
6767
</type>
68-
<preference for="Magento\Store\Model\StoreCodeInRequestPathInterface" type="Magento\Store\Model\StoreCodeInRequestPath" />
6968
</config>

0 commit comments

Comments
 (0)