diff --git a/app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index 0fb00c89cc122..01fe2188854c2 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php
index ca9b550ca31de..8d328d9a62292 100644
--- a/app/code/Magento/Catalog/Helper/Product/View.php
+++ b/app/code/Magento/Catalog/Helper/Product/View.php
@@ -118,7 +118,8 @@ private function preparePageMetadata(ResultPage $resultPage, $product)
$pageConfig = $resultPage->getConfig();
$metaTitle = $product->getMetaTitle();
- $pageConfig->setMetaTitle($metaTitle);
+ $productMetaTitle = $metaTitle ? $this->addConfigValues($metaTitle) : null;
+ $pageConfig->setMetaTitle($productMetaTitle);
$pageConfig->getTitle()->set($metaTitle ?: $product->getName());
$keyword = $product->getMetaKeyword();
@@ -294,4 +295,22 @@ public function prepareAndRender(ResultPage $resultPage, $productId, $controller
$this->preparePageMetadata($resultPage, $product);
return $this;
}
+
+ /**
+ * Add Prefix and Suffix as per the configuration.
+ *
+ * @param string $title
+ * @return string
+ */
+ private function addConfigValues(string $title): string
+ {
+ $preparedTitle = $this->scopeConfig->getValue(
+ 'design/head/title_prefix',
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ ) . ' ' . $title . ' ' . $this->scopeConfig->getValue(
+ 'design/head/title_suffix',
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ );
+ return trim($preparedTitle);
+ }
}
diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php
index c586563759b54..29f940021ee6d 100644
--- a/app/code/Magento/Catalog/Model/ProductRepository.php
+++ b/app/code/Magento/Catalog/Model/ProductRepository.php
@@ -66,11 +66,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
protected $instancesById = [];
- /**
- * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper
- */
- protected $initializationHelper;
-
/**
* @var \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory
*/
@@ -195,7 +190,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
/**
* ProductRepository constructor.
* @param ProductFactory $productFactory
- * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper
* @param \Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory
* @param ResourceModel\Product\CollectionFactory $collectionFactory
* @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder
@@ -225,7 +219,6 @@ class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterfa
*/
public function __construct(
ProductFactory $productFactory,
- \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper,
\Magento\Catalog\Api\Data\ProductSearchResultsInterfaceFactory $searchResultsFactory,
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory,
\Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder,
@@ -253,7 +246,6 @@ public function __construct(
) {
$this->productFactory = $productFactory;
$this->collectionFactory = $collectionFactory;
- $this->initializationHelper = $initializationHelper;
$this->searchResultsFactory = $searchResultsFactory;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
$this->resourceModel = $resourceModel;
@@ -940,7 +932,7 @@ private function joinPositionField(
foreach ($filterGroup->getFilters() as $filter) {
if ($filter->getField() === 'category_id') {
$filterValue = $filter->getValue();
- $categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue ?? '');
+ $categoryIds[] = is_array($filterValue) ? $filterValue : explode(',', $filterValue);
}
}
}
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml
index f4e38009d6772..e5b7d57a50200 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductImageStorefrontProductPageActionGroup.xml
@@ -19,7 +19,7 @@
-
-
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index 47bfa67168e91..01480d6ca68ce 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml
index 2dd4b021bc597..0f97d9454c878 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml
@@ -15,7 +15,8 @@
-
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml
index f342231f98f3a..fea3ab8c2efa6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml
@@ -110,12 +110,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php
index 166b38e3d0910..328fa181684d3 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Category/Attribute/Backend/SortbyTest.php
@@ -18,7 +18,7 @@
class SortbyTest extends TestCase
{
- const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';
+ private const DEFAULT_ATTRIBUTE_CODE = 'attribute_name';
/**
* @var Sortby
@@ -45,7 +45,6 @@ class SortbyTest extends TestCase
*/
protected function setUp(): void
{
- $this->markTestSkipped('Due to MAGETWO-48956');
$this->objectHelper = new ObjectManager($this);
$this->scopeConfig = $this->getMockForAbstractClass(ScopeConfigInterface::class);
$this->model = $this->objectHelper->getObject(
@@ -217,7 +216,7 @@ public function testValidateUnique(): void
{
$this->attribute->expects($this->any())->method('getName')->willReturn('attribute_name');
$this->attribute->method('getIsRequired');
- $this->attribute§('getIsUnique')
+ $this->attribute->method('getIsUnique')
->willReturn(true);
$entityMock = $this->getMockForAbstractClass(
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
index 306905a24fcb0..53cfdbd6f64df 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php
@@ -77,11 +77,6 @@ class ProductRepositoryTest extends TestCase
*/
private $model;
- /**
- * @var Helper|MockObject
- */
- private $initializationHelper;
-
/**
* @var Product|MockObject
*/
@@ -255,7 +250,6 @@ protected function setUp(): void
->method('hasGalleryAttribute')
->willReturn(true);
$this->filterBuilder = $this->createMock(FilterBuilder::class);
- $this->initializationHelper = $this->createMock(Helper::class);
$this->collectionFactory = $this->createPartialMock(CollectionFactory::class, ['create']);
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
$this->metadataService = $this->getMockForAbstractClass(ProductAttributeRepositoryInterface::class);
@@ -342,7 +336,6 @@ function ($value) {
ProductRepository::class,
[
'productFactory' => $this->productFactory,
- 'initializationHelper' => $this->initializationHelper,
'resourceModel' => $this->resourceModel,
'filterBuilder' => $this->filterBuilder,
'collectionFactory' => $this->collectionFactory,
@@ -723,7 +716,6 @@ public function testSaveExisting(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -748,7 +740,6 @@ public function testSaveNew(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
@@ -774,7 +765,6 @@ public function testSaveUnableToSaveException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)
@@ -800,7 +790,6 @@ public function testSaveException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
@@ -830,7 +819,6 @@ public function testSaveInvalidProductException(): void
$this->productFactory->expects($this->exactly(2))
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(['error1', 'error2']);
$this->product->expects($this->once())->method('getId')->willReturn(null);
@@ -854,8 +842,6 @@ public function testSaveThrowsTemporaryStateExceptionIfDatabaseConnectionErrorOc
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())
- ->method('initialize');
$this->resourceModel->expects($this->once())
->method('validate')
->with($this->product)
@@ -1018,7 +1004,6 @@ public function testSaveExistingWithOptions(array $newOptions): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
@@ -1184,7 +1169,6 @@ public function testSaveWithLinks(array $newLinks, array $existingLinks, array $
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
@@ -1354,7 +1338,6 @@ protected function setupProductMocksForSave(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->initializedProduct);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->initializedProduct)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')
@@ -1475,7 +1458,6 @@ public function testSaveWithDifferentWebsites(): void
$this->productFactory->expects($this->any())
->method('create')
->willReturn($this->product);
- $this->initializationHelper->expects($this->never())->method('initialize');
$this->resourceModel->expects($this->once())->method('validate')->with($this->product)
->willReturn(true);
$this->resourceModel->expects($this->once())->method('save')->with($this->product)->willReturn(true);
diff --git a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php
index 0ef5adf7a1888..dad564e95ca79 100644
--- a/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php
+++ b/app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php
@@ -9,16 +9,16 @@
use Magento\Framework\View\Element\UiComponent\ContextInterface;
/**
- * Class Thumbnail
+ * Class prepares Thumbnail
*
* @api
* @since 100.0.2
*/
class Thumbnail extends \Magento\Ui\Component\Listing\Columns\Column
{
- const NAME = 'thumbnail';
+ public const NAME = 'thumbnail';
- const ALT_FIELD = 'name';
+ public const ALT_FIELD = 'name';
/**
* @var \Magento\Catalog\Helper\Image
@@ -77,7 +77,6 @@ public function prepareDataSource(array $dataSource)
return $dataSource;
}
-
/**
* Get Alt
*
@@ -88,6 +87,7 @@ public function prepareDataSource(array $dataSource)
protected function getAlt($row)
{
$altField = $this->getData('config/altField') ?: self::ALT_FIELD;
- return $row[$altField] ?? null;
+ // phpcs:disable Magento2.Functions.DiscouragedFunction
+ return html_entity_decode($row[$altField], ENT_QUOTES, "UTF-8") ?? null;
}
}
diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
index 6e24f84f00482..33fbf78981783 100644
--- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
+++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
@@ -36,7 +36,7 @@
-
+
@@ -111,14 +111,14 @@
-
+
gallery-prev-area
-
+
gallery-next-area
Skip to the end of the images gallery
@@ -132,7 +132,7 @@
-
+
gallery-prev-area
Skip to the beginning of the images gallery
diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml
index 4b33864aef47a..ce0fa3827afe0 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml
@@ -8,6 +8,7 @@
* Product media data template
*
* @var $block \Magento\Catalog\Block\Product\View\Gallery
+ * @var $escaper \Magento\Framework\Escaper
*/
?>
@@ -25,6 +26,8 @@ $helper = $block->getData('imageHelper');
$mainImageData = $mainImage ?
$mainImage->getData('medium_image_url') :
$helper->getDefaultPlaceholderUrl('image');
+ $imageWidth = $block->getImageAttribute('product_page_image_medium', 'width');
+ $imageHeight = $block->getImageAttribute('product_page_image_medium', 'height');
?>
@@ -33,9 +36,11 @@ $mainImageData = $mainImage ?
alt="main product photo"
class="gallery-placeholder__image"
src="= /* @noEscape */ $mainImageData ?>"
+ = $imageWidth ? 'width="'. $escaper->escapeHtmlAttr($imageWidth) .'"' : '' ?>
+ = $imageHeight ? 'height="'. $escaper->escapeHtmlAttr($imageHeight) .'"' : '' ?>
/>
-
+