Skip to content

Commit 73155e3

Browse files
Merge branch '2.4-develop' into PR-VK-2023-09-29
2 parents 7ca90bc + 0c1f257 commit 73155e3

File tree

57 files changed

+1647
-1114
lines changed

Some content is hidden

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

57 files changed

+1647
-1114
lines changed

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<element name="minPrice" type="text" selector="span[data-price-type='minPrice']"/>
1515
<element name="maxPrice" type="text" selector="span[data-price-type='minPrice']"/>
1616
<element name="asLowAsFinalPrice" type="text" selector="div.price-box.price-final_price p.minimal-price > span.price-final_price span.price"/>
17-
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price > span.price-final_price span.price"/>
17+
<element name="fixedFinalPrice" type="text" selector="div.price-box.price-final_price p.price-from span.price-final_price span.price-wrapper span.price"/>
1818
<element name="productBundleOptionsCheckbox" type="checkbox" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/../input" parameterized="true" timeout="30"/>
1919
<element name="productBundleOneOptionInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'option')]" parameterized="true" timeout="30"/>
2020
<element name="productBundleOptionQty" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{childName}}')]/..//input[contains(@class, 'qty')]" parameterized="true" timeout="30"/>

app/code/Magento/Catalog/Helper/Product/View.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ private function preparePageMetadata(ResultPage $resultPage, $product)
118118
$pageConfig = $resultPage->getConfig();
119119

120120
$metaTitle = $product->getMetaTitle();
121-
$pageConfig->setMetaTitle($metaTitle);
121+
$productMetaTitle = $metaTitle ? $this->addConfigValues($metaTitle) : null;
122+
$pageConfig->setMetaTitle($productMetaTitle);
122123
$pageConfig->getTitle()->set($metaTitle ?: $product->getName());
123124

124125
$keyword = $product->getMetaKeyword();
@@ -294,4 +295,22 @@ public function prepareAndRender(ResultPage $resultPage, $productId, $controller
294295
$this->preparePageMetadata($resultPage, $product);
295296
return $this;
296297
}
298+
299+
/**
300+
* Add Prefix and Suffix as per the configuration.
301+
*
302+
* @param string $title
303+
* @return string
304+
*/
305+
private function addConfigValues(string $title): string
306+
{
307+
$preparedTitle = $this->scopeConfig->getValue(
308+
'design/head/title_prefix',
309+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
310+
) . ' ' . $title . ' ' . $this->scopeConfig->getValue(
311+
'design/head/title_suffix',
312+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
313+
);
314+
return trim($preparedTitle);
315+
}
297316
}

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
6666
*/
6767
protected $instancesById = [];
6868

69-
/**
70-
* @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
71-
*/
72-
protected $initializationHelper;
73-
7469
/**
7570
* @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory
7671
*/
@@ -195,7 +190,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
195190
/**
196191
* ProductRepository constructor.
197192
* @param ProductFactory $productFactory
198-
* @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
199193
* @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory
200194
* @param ResourceModel\Product\CollectionFactory $collectionFactory
201195
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
@@ -225,7 +219,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
225219
*/
226220
public function __construct(
227221
ProductFactory $productFactory,
228-
\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
229222
\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory,
230223
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
231224
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
@@ -253,7 +246,6 @@ public function __construct(
253246
) {
254247
$this->productFactory = $productFactory;
255248
$this->collectionFactory = $collectionFactory;
256-
$this->initializationHelper = $initializationHelper;
257249
$this->searchResultsFactory = $searchResultsFactory;
258250
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
259251
$this->resourceModel = $resourceModel;
@@ -940,7 +932,7 @@ private function joinPositionField(
940932
foreach ($filterGroup->getFilters() as $filter) {
941933
if ($filter->getField() === 'category_id') {
942934
$filterValue = $filter->getValue();
943-
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue ?? '');
935+
$categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue);
944936
}
945937
}
946938
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<seeInCurrentUrl url="/{{product.urlKey}}.html" stepKey="checkUrl"/>
2121
<waitForPageLoad stepKey="waitForPageLoad"/>
22-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="waitForImage"/>
23-
<seeElement selector="{{StorefrontProductMediaSection.imageFile(image.filename)}}" stepKey="seeImage"/>
22+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery(image.filename)}}" stepKey="waitForImage"/>
23+
<seeElement selector="{{StorefrontProductMediaSection.imageFileInGallery(image.filename)}}" stepKey="seeImage"/>
2424
</actionGroup>
2525
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<element name="oldPriceTag" type="text" selector=".old-price .price-label"/>
2525
<element name="oldPriceAmount" type="text" selector=".old-price span.price"/>
2626
<element name="productStockStatus" type="text" selector=".stock[title=Availability]>span"/>
27-
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[@class='fotorama__img']"/>
28-
<element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@src, '{{src}}')]" parameterized="true"/>
27+
<element name="productImage" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@class, 'fotorama__img')]"/>
28+
<element name="productImageSrc" type="text" selector="//*[@id='maincontent']//div[@class='gallery-placeholder']//img[contains(@class, 'fotorama__img')][contains(@src, '{{src}}')]" parameterized="true"/>
2929
<element name="productDescription" type="text" selector="#description .value"/>
3030
<element name="productOptionFieldInput" type="input" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//input[@type='text']" parameterized="true"/>
3131
<element name="productOptionAreaInput" type="textarea" selector="//*[@id='product-options-wrapper']//div[@class='fieldset']//label[contains(.,'{{var1}}')]/../div[@class='control']//textarea" parameterized="true"/>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<element name="productImage" type="text" selector="//*[@data-gallery-role='gallery' and not(contains(@class, 'fullscreen'))]//img[contains(@src, '{{filename}}') and not(contains(@class, 'full'))]" parameterized="true" />
1616
<element name="productImageFullscreen" type="text" selector="//*[@data-gallery-role='gallery' and contains(@class, 'fullscreen')]//img[contains(@src, '{{filename}}') and contains(@class, 'full')]" parameterized="true" />
1717
<element name="closeFullscreenImage" type="button" selector="//*[@data-gallery-role='gallery' and contains(@class, 'fullscreen')]//*[@data-gallery-role='fotorama__fullscreen-icon']" />
18-
<element name="imageFile" type="text" selector="//*[@class='product media']//img[contains(@src, '{{filename}}')]" parameterized="true"/>
18+
<element name="imageFile" type="text" selector="//div[contains(@class, 'fotorama__active')]//img[contains(@src, '{{filename}}')]" parameterized="true"/>
19+
<element name="imageFileInGallery" type="text" selector="//div[contains(@class, 'fotorama__loaded--img')]//img[contains(@src, '{{filename}}')]" parameterized="true"/>
1920
<element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/>
2021
<element name="productImageInFotorama" type="file" selector=".fotorama__nav__shaft img[src*='{{imageName}}']" parameterized="true" timeout="30"/>
2122
<element name="fotoramaPrevButton" type="button" selector="//*[@data-gallery-role='gallery']//*[@data-gallery-role='nav-wrap']//*[@data-gallery-role='arrow' and contains(@class, 'fotorama__thumb__arr--left')]" timeout="30"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@
110110
<waitForPageLoad stepKey="waitForStorefront"/>
111111

112112
<!-- See all of the images that we uploaded -->
113-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('small')}}" stepKey="seeSmall"/>
114-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('medium')}}" stepKey="seeMedium"/>
115-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('large')}}" stepKey="seeLarge"/>
116-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('gif')}}" stepKey="seeGif"/>
117-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('jpg')}}" stepKey="seeJpg"/>
118-
<waitForElement selector="{{StorefrontProductMediaSection.imageFile('png')}}" stepKey="seePng"/>
113+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('small')}}" stepKey="seeSmall"/>
114+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('medium')}}" stepKey="seeMedium"/>
115+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('large')}}" stepKey="seeLarge"/>
116+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('gif')}}" stepKey="seeGif"/>
117+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('jpg')}}" stepKey="seeJpg"/>
118+
<waitForElement selector="{{StorefrontProductMediaSection.imageFileInGallery('png')}}" stepKey="seePng"/>
119119

120120
<!-- Go to the category page and see a placeholder image for the second product -->
121121
<amOnPage url="$$category.custom_attributes[url_key]$$.html" stepKey="goToCategoryPage"/>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontVerifyCategoryPageNotCachedTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!--Login to Admin Panel-->
2323
<actionGroup ref="AdminLoginActionGroup" stepKey="logInAsAdmin"/>
2424
<!-- Create tax rate for CA -->
25-
<createData entity="US_CA_Rate_1" stepKey="createTaxRateCA"/>
25+
<createData entity="TaxRateCalifornia" stepKey="createTaxRateCA"/>
2626
<!-- Create tax rate for TX -->
2727
<createData entity="ThirdTaxRateTexas" stepKey="createTaxRateTX"/>
2828
<!-- Create Tax Rules -->

app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class SortbyTest extends TestCase
2020
{
21-
const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';
21+
private const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';
2222

2323
/**
2424
* @var Sortby
@@ -45,7 +45,6 @@ class SortbyTest extends TestCase
4545
*/
4646
protected function setUp(): void
4747
{
48-
$this->markTestSkipped('Due to MAGETWO-48956');
4948
$this->objectHelper = new ObjectManager($this);
5049
$this->scopeConfig = $this->getMockForAbstractClass(ScopeConfigInterface::class);
5150
$this->model = $this->objectHelper->getObject(
@@ -217,7 +216,7 @@ public function testValidateUnique(): void
217216
{
218217
$this->attribute->expects($this->any())->method('getName')->willReturn('attribute_name');
219218
$this->attribute->method('getIsRequired');
220-
$this->attribute§('getIsUnique')
219+
$this->attribute->method('getIsUnique')
221220
->willReturn(true);
222221

223222
$entityMock = $this->getMockForAbstractClass(

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ class ProductRepositoryTest extends TestCase
7777
*/
7878
private $model;
7979

80-
/**
81-
* @var Helper|MockObject
82-
*/
83-
private $initializationHelper;
84-
8580
/**
8681
* @var Product|MockObject
8782
*/
@@ -255,7 +250,6 @@ protected function setUp(): void
255250
->method('hasGalleryAttribute')
256251
->willReturn(true);
257252
$this->filterBuilder = $this->createMock(FilterBuilder::class);
258-
$this->initializationHelper = $this->createMock(Helper::class);
259253
$this->collectionFactory = $this->createPartialMock(CollectionFactory::class, ['create']);
260254
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
261255
$this->metadataService = $this->getMockForAbstractClass(ProductAttributeRepositoryInterface::class);
@@ -342,7 +336,6 @@ function ($value) {
342336
ProductRepository::class,
343337
[
344338
'productFactory' => $this->productFactory,
345-
'initializationHelper' => $this->initializationHelper,
346339
'resourceModel' => $this->resourceModel,
347340
'filterBuilder' => $this->filterBuilder,
348341
'collectionFactory' => $this->collectionFactory,
@@ -723,7 +716,6 @@ public function testSaveExisting(): void
723716
$this->productFactory->expects($this->any())
724717
->method('create')
725718
->willReturn($this->product);
726-
$this->initializationHelper->expects($this->never())->method('initialize');
727719
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
728720
->willReturn(true);
729721
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -748,7 +740,6 @@ public function testSaveNew(): void
748740
$this->productFactory->expects($this->any())
749741
->method('create')
750742
->willReturn($this->product);
751-
$this->initializationHelper->expects($this->never())->method('initialize');
752743
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
753744
->willReturn(true);
754745
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -774,7 +765,6 @@ public function testSaveUnableToSaveException(): void
774765
$this->productFactory->expects($this->exactly(2))
775766
->method('create')
776767
->willReturn($this->product);
777-
$this->initializationHelper->expects($this->never())->method('initialize');
778768
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
779769
->willReturn(true);
780770
$this->resourceModel->expects($this->once())->method('save')->with($this->product)
@@ -800,7 +790,6 @@ public function testSaveException(): void
800790
$this->productFactory->expects($this->exactly(2))
801791
->method('create')
802792
->willReturn($this->product);
803-
$this->initializationHelper->expects($this->never())->method('initialize');
804793
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
805794
->willReturn(true);
806795

@@ -830,7 +819,6 @@ public function testSaveInvalidProductException(): void
830819
$this->productFactory->expects($this->exactly(2))
831820
->method('create')
832821
->willReturn($this->product);
833-
$this->initializationHelper->expects($this->never())->method('initialize');
834822
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
835823
->willReturn(['error1', 'error2']);
836824
$this->product->expects($this->once())->method('getId')->willReturn(null);
@@ -854,8 +842,6 @@ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOc
854842
$this->productFactory->expects($this->any())
855843
->method('create')
856844
->willReturn($this->product);
857-
$this->initializationHelper->expects($this->never())
858-
->method('initialize');
859845
$this->resourceModel->expects($this->once())
860846
->method('validate')
861847
->with($this->product)
@@ -1018,7 +1004,6 @@ public function testSaveExistingWithOptions(array $newOptions): void
10181004
$this->productFactory->expects($this->any())
10191005
->method('create')
10201006
->willReturn($this->initializedProduct);
1021-
$this->initializationHelper->expects($this->never())->method('initialize');
10221007
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
10231008
->willReturn(true);
10241009
$this->resourceModel->expects($this->once())->method('save')
@@ -1184,7 +1169,6 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
11841169
$this->productFactory->expects($this->any())
11851170
->method('create')
11861171
->willReturn($this->initializedProduct);
1187-
$this->initializationHelper->expects($this->never())->method('initialize');
11881172
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
11891173
->willReturn(true);
11901174
$this->resourceModel->expects($this->once())->method('save')
@@ -1354,7 +1338,6 @@ protected function setupProductMocksForSave(): void
13541338
$this->productFactory->expects($this->any())
13551339
->method('create')
13561340
->willReturn($this->initializedProduct);
1357-
$this->initializationHelper->expects($this->never())->method('initialize');
13581341
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
13591342
->willReturn(true);
13601343
$this->resourceModel->expects($this->once())->method('save')
@@ -1475,7 +1458,6 @@ public function testSaveWithDifferentWebsites(): void
14751458
$this->productFactory->expects($this->any())
14761459
->method('create')
14771460
->willReturn($this->product);
1478-
$this->initializationHelper->expects($this->never())->method('initialize');
14791461
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
14801462
->willReturn(true);
14811463
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);

app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1010

1111
/**
12-
* Class Thumbnail
12+
* Class prepares Thumbnail
1313
*
1414
* @api
1515
* @since 100.0.2
1616
*/
1717
class Thumbnail extends \Magento\Ui\Component\Listing\Columns\Column
1818
{
19-
const NAME = 'thumbnail';
19+
public const NAME = 'thumbnail';
2020

21-
const ALT_FIELD = 'name';
21+
public const ALT_FIELD = 'name';
2222

2323
/**
2424
* @var \Magento\Catalog\Helper\Image
@@ -77,7 +77,6 @@ public function prepareDataSource(array $dataSource)
7777

7878
return $dataSource;
7979
}
80-
8180
/**
8281
* Get Alt
8382
*
@@ -88,6 +87,7 @@ public function prepareDataSource(array $dataSource)
8887
protected function getAlt($row)
8988
{
9089
$altField = $this->getData('config/altField') ?: self::ALT_FIELD;
91-
return $row[$altField] ?? null;
90+
// phpcs:disable Magento2.Functions.DiscouragedFunction
91+
return html_entity_decode($row[$altField], ENT_QUOTES, "UTF-8") ?? null;
9292
}
9393
}

0 commit comments

Comments
 (0)