Skip to content

Commit a13bba9

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.4-develop' into B2B-319
2 parents 5b7c003 + e6e6725 commit a13bba9

File tree

61 files changed

+1327
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1327
-432
lines changed

app/code/Magento/Backend/view/adminhtml/web/js/translate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define([
3535
* @return {String}
3636
*/
3737
this.translate = function (text) {
38-
return _data[text] ? _data[text] : text;
38+
return typeof _data[text] === 'string' ? _data[text] : text;
3939
};
4040

4141
return this;

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
use Magento\Store\Model\Indexer\WebsiteDimensionProvider;
1616
use Magento\Framework\Search\Request\IndexScopeResolverInterface;
1717

18+
/**
19+
* Class LinkedProductSelectBuilderByIndexPrice
20+
*
21+
* Provide Select object for retrieve product id by index price.
22+
*
23+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
24+
*/
1825
class LinkedProductSelectBuilderByIndexPrice implements LinkedProductSelectBuilderInterface
1926
{
2027
/**
@@ -83,13 +90,13 @@ public function __construct(
8390
}
8491

8592
/**
86-
* {@inheritdoc}
93+
* @inheritdoc
8794
*/
88-
public function build($productId)
95+
public function build(int $productId, int $storeId) : array
8996
{
9097
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
9198
$productTable = $this->resource->getTableName('catalog_product_entity');
92-
$websiteId = $this->storeManager->getStore()->getWebsiteId();
99+
$websiteId = $this->storeManager->getStore($storeId)->getWebsiteId();
93100
$customerGroupId = $this->customerSession->getCustomerGroupId();
94101

95102
$priceSelect = $this->resource->getConnection()->select()

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByBasePrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function __construct(
7474
/**
7575
* @inheritdoc
7676
*/
77-
public function build($productId)
77+
public function build(int $productId, int $storeId) : array
7878
{
7979
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
8080
$priceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'price');
@@ -104,7 +104,7 @@ public function build($productId)
104104

105105
if (!$this->catalogHelper->isPriceGlobal()) {
106106
$priceSelectStore = clone $priceSelect;
107-
$priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId());
107+
$priceSelectStore->where('t.store_id = ?', $storeId);
108108
$selects[] = $priceSelectStore;
109109
}
110110

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderBySpecialPrice.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
use Magento\Store\Model\Store;
1313

1414
/**
15+
* LinkedProductSelectBuilderBySpecialPrice
16+
*
17+
* Provide Select object for retrieve product id by special price
18+
*
1519
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1620
*/
1721
class LinkedProductSelectBuilderBySpecialPrice implements LinkedProductSelectBuilderInterface
@@ -88,16 +92,16 @@ public function __construct(
8892
}
8993

9094
/**
91-
* {@inheritdoc}
95+
* @inheritdoc
9296
*/
93-
public function build($productId)
97+
public function build(int $productId, int $storeId) : array
9498
{
9599
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
96100
$connection = $this->resource->getConnection();
97101
$specialPriceAttribute = $this->eavConfig->getAttribute(Product::ENTITY, 'special_price');
98102
$specialPriceFromDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_from_date');
99103
$specialPriceToDate = $this->eavConfig->getAttribute(Product::ENTITY, 'special_to_date');
100-
$timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore());
104+
$timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore($storeId));
101105
$currentDate = $this->dateTime->formatDate($timestamp, false);
102106
$productTable = $this->resource->getTableName('catalog_product_entity');
103107

@@ -145,7 +149,7 @@ public function build($productId)
145149

146150
if (!$this->catalogHelper->isPriceGlobal()) {
147151
$priceSelectStore = clone $specialPrice;
148-
$priceSelectStore->where('t.store_id = ?', $this->storeManager->getStore()->getId());
152+
$priceSelectStore->where('t.store_id = ?', $storeId);
149153
$selects[] = $priceSelectStore;
150154
}
151155

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderByTierPrice.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\DB\Select;
1111

12+
/**
13+
* LinkedProductSelectBuilderByTierPrice
14+
*
15+
* Provide Select object for retrieve product id by tier price
16+
*
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
18+
*/
1219
class LinkedProductSelectBuilderByTierPrice implements LinkedProductSelectBuilderInterface
1320
{
1421
/**
1522
* Default website id
23+
*
24+
* Constant represents default website id
1625
*/
1726
const DEFAULT_WEBSITE_ID = 0;
1827

@@ -72,9 +81,9 @@ public function __construct(
7281
}
7382

7483
/**
75-
* {@inheritdoc}
84+
* @inheritdoc
7685
*/
77-
public function build($productId)
86+
public function build(int $productId, int $storeId) : array
7887
{
7988
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
8089
$productTable = $this->resource->getTableName('catalog_product_entity');
@@ -103,7 +112,7 @@ public function build($productId)
103112

104113
if (!$this->catalogHelper->isPriceGlobal()) {
105114
$priceSelectStore = clone $priceSelect;
106-
$priceSelectStore->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId());
115+
$priceSelectStore->where('t.website_id = ?', $this->storeManager->getStore($storeId)->getWebsiteId());
107116
$selects[] = $priceSelectStore;
108117
}
109118

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderComposite.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Catalog\Model\ResourceModel\Product;
88

9+
/**
10+
* Collect Select object for list of products
11+
*/
912
class LinkedProductSelectBuilderComposite implements LinkedProductSelectBuilderInterface
1013
{
1114
/**
@@ -22,14 +25,15 @@ public function __construct($linkedProductSelectBuilder)
2225
}
2326

2427
/**
25-
* {@inheritdoc}
28+
* @inheritdoc
2629
*/
27-
public function build($productId)
30+
public function build(int $productId, int $storeId) : array
2831
{
2932
$selects = [];
3033
foreach ($this->linkedProductSelectBuilder as $productSelectBuilder) {
31-
$selects = array_merge($selects, $productSelectBuilder->build($productId));
34+
$selects[] = $productSelectBuilder->build($productId, $storeId);
3235
}
36+
$selects = array_merge(...$selects);
3337

3438
return $selects;
3539
}

app/code/Magento/Catalog/Model/ResourceModel/Product/LinkedProductSelectBuilderInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
interface LinkedProductSelectBuilderInterface
1212
{
1313
/**
14+
* Build Select objects
15+
*
1416
* @param int $productId
17+
* @param int $storeId
1518
* @return \Magento\Framework\DB\Select[]
1619
*/
17-
public function build($productId);
20+
public function build(int $productId, int $storeId) : array;
1821
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<argument name="value" type="string"/>
1717
</arguments>
1818

19-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
19+
<conditionalClick selector="{{AdminCategorySEOSection.SectionHeader}}" dependentSelector="{{AdminCategorySEOSection.sectionBody}}" visible="false" stepKey="openSeoSection"/>
2020
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
2121
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
2222
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="assertSuccessMessage"/>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/ChangeSeoUrlKeyForSubCategoryActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<argument name="value" type="string"/>
1717
</arguments>
1818

19-
<click selector="{{AdminCategorySEOSection.SectionHeader}}" stepKey="openSeoSection"/>
19+
<conditionalClick selector="{{AdminCategorySEOSection.SectionHeader}}" dependentSelector="{{AdminCategorySEOSection.sectionBody}}" visible="false" stepKey="openSeoSection"/>
2020
<uncheckOption selector="{{AdminCategorySEOSection.UrlKeyDefaultValueCheckbox}}" stepKey="uncheckDefaultValue"/>
2121
<fillField selector="{{AdminCategorySEOSection.UrlKeyInput}}" userInput="{{value}}" stepKey="enterURLKey"/>
2222
<click selector="{{AdminCategoryMainActionsSection.SaveButton}}" stepKey="saveCategory"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontProductPageSelectDropDownOptionValueActionGroup">
12+
<annotations>
13+
<description>Selects the provided Product Option Value under the provided DropDown Product Option Title on a Storefront Product page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeLabel" type="string" defaultValue="{{ProductAttributeFrontendLabel.label}}"/>
17+
<argument name="optionLabel" type="string" defaultValue="{{productAttributeOption1.label}}"/>
18+
</arguments>
19+
20+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeLabel)}}" userInput="{{optionLabel}}" stepKey="fillDropDownAttributeOption"/>
21+
</actionGroup>
22+
</actionGroups>

0 commit comments

Comments
 (0)