Skip to content

Commit 52bb2e8

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into 2.4-develop
2 parents 5859d55 + feedc93 commit 52bb2e8

File tree

153 files changed

+4798
-1568
lines changed

Some content is hidden

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

153 files changed

+4798
-1568
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/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Catalog\Model\Entity\Attribute;
1414
use Magento\Eav\Block\Adminhtml\Attribute\PropertyLocker;
1515
use Magento\Framework\Data\FormFactory;
16+
use Magento\Framework\Exception\LocalizedException;
1617
use Magento\Framework\Registry;
1718

1819
/**
@@ -58,6 +59,7 @@ public function __construct(
5859
* @inheritDoc
5960
* @return $this
6061
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
62+
* @throws LocalizedException
6163
*/
6264
protected function _prepareForm()
6365
{
@@ -176,28 +178,34 @@ protected function _prepareForm()
176178
['form' => $form, 'attribute' => $attributeObject]
177179
);
178180

181+
$dependencies = $this->getLayout()->createBlock(
182+
\Magento\Backend\Block\Widget\Form\Element\Dependence::class
183+
)->addFieldMap(
184+
"is_html_allowed_on_front",
185+
'html_allowed_on_front'
186+
)->addFieldMap(
187+
"frontend_input",
188+
'frontend_input_type'
189+
)->addFieldMap(
190+
"is_searchable",
191+
'searchable'
192+
)->addFieldMap(
193+
"is_visible_in_advanced_search",
194+
'advanced_search'
195+
)->addFieldDependence(
196+
'advanced_search',
197+
'searchable',
198+
'1'
199+
);
200+
$this->_eventManager->dispatch(
201+
'adminhtml_catalog_product_attribute_edit_frontend_prepare_field_dependencies',
202+
['dependencies' => $dependencies]
203+
);
204+
179205
// define field dependencies
180206
$this->setChild(
181207
'form_after',
182-
$this->getLayout()->createBlock(
183-
\Magento\Backend\Block\Widget\Form\Element\Dependence::class
184-
)->addFieldMap(
185-
"is_html_allowed_on_front",
186-
'html_allowed_on_front'
187-
)->addFieldMap(
188-
"frontend_input",
189-
'frontend_input_type'
190-
)->addFieldMap(
191-
"is_searchable",
192-
'searchable'
193-
)->addFieldMap(
194-
"is_visible_in_advanced_search",
195-
'advanced_search'
196-
)->addFieldDependence(
197-
'advanced_search',
198-
'searchable',
199-
'1'
200-
)
208+
$dependencies
201209
);
202210

203211
$this->setForm($form);

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/Model/ProductRepository/MediaGalleryProcessor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function __construct(
8282
* @throws InputException
8383
* @throws StateException
8484
* @throws LocalizedException
85+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
8586
*/
8687
public function processMediaGallery(ProductInterface $product, array $mediaGalleryEntries) :void
8788
{
@@ -113,6 +114,9 @@ public function processMediaGallery(ProductInterface $product, array $mediaGalle
113114
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
114115
$existingMediaGallery[$key] = array_merge($existingEntry, $updatedEntry);
115116
}
117+
} elseif (!empty($newEntries) && isset($existingEntry['value_id'])) {
118+
//avoid deleting an exiting image while adding a new one
119+
unset($existingMediaGallery[$key]);
116120
} elseif ($this->canRemoveImage($product, $existingEntry)) {
117121
//set the removed flag
118122
$existingEntry['removed'] = true;

app/code/Magento/Catalog/Model/ResourceModel/Category/Collection.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* Category resource collection
1717
*
1818
* @api
19-
* @author Magento Core Team <core@magentocommerce.com>
2019
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2120
* @since 100.0.2
2221
*/
@@ -568,8 +567,7 @@ private function getProductsCountFromCategoryTable(Category $item, string $websi
568567
*/
569568
private function getProductsCountQuery(array $categoryIds, $addVisibilityFilter = true): Select
570569
{
571-
$connections = $this->_resource->getConnection();
572-
$categoryTable = $connections->getTableName('catalog_category_product_index');
570+
$categoryTable = $this->_resource->getTableName('catalog_category_product_index');
573571
$select = $this->_conn->select()
574572
->from(
575573
['cat_index' => $categoryTable],

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"/>

0 commit comments

Comments
 (0)