Skip to content

Commit b0ecc08

Browse files
authored
Merge branch '2.4-develop' into fix-for-issue-37957
2 parents 0a6a23b + f6d4542 commit b0ecc08

File tree

204 files changed

+6022
-1755
lines changed

Some content is hidden

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

204 files changed

+6022
-1755
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"/>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* ADOBE CONFIDENTIAL
5+
* ___________________
6+
*
7+
* Copyright 2014 Adobe
8+
* All Rights Reserved.
9+
*
10+
* NOTICE: All information contained herein is, and remains
11+
* the property of Adobe and its suppliers, if any. The intellectual
12+
* and technical concepts contained herein are proprietary to Adobe
13+
* and its suppliers and are protected by all applicable intellectual
14+
* property laws, including trade secret and copyright laws.
15+
* Dissemination of this information or reproduction of this material
16+
* is strictly forbidden unless prior written permission is obtained
17+
* from Adobe.
18+
* ************************************************************************
19+
*/
20+
declare(strict_types=1);
21+
22+
namespace Magento\Catalog\Api;
23+
24+
/**
25+
* Intended to allow setting 'is_filterable' property for specific attribute as integer value via REST/SOAP API
26+
*
27+
* @api
28+
*/
29+
interface ProductAttributeIsFilterableManagementInterface
30+
{
31+
/**
32+
* Retrieve 'is_filterable' property for specific attribute as integer
33+
*
34+
* @param string $attributeCode
35+
* @return int
36+
* @throws \Magento\Framework\Exception\NoSuchEntityException
37+
*/
38+
public function get(string $attributeCode): int;
39+
40+
/**
41+
* Set 'is_filterable' property for specific attribute as integer
42+
*
43+
* @param string $attributeCode
44+
* @param int $isFilterable
45+
* @return bool
46+
* @throws \Magento\Framework\Exception\NoSuchEntityException
47+
* @throws \Magento\Framework\Exception\InputException
48+
* @throws \Magento\Framework\Exception\StateException
49+
*/
50+
public function set(string $attributeCode, int $isFilterable): bool;
51+
}

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/Indexer/Product/Price/Action/Full.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,14 @@ private function reindexByBatchWithDimensions(
311311
if (!empty($entityIds)) {
312312
$this->dimensionTableMaintainer->createMainTmpTable($dimensions);
313313
$temporaryTable = $this->dimensionTableMaintainer->getMainTmpTable($dimensions);
314-
$this->_emptyTable($temporaryTable);
315-
316314
$priceIndexer->executeByDimensions($dimensions, \SplFixedArray::fromArray($entityIds, false));
317315

318316
// Sync data from temp table to index table
319317
$this->_insertFromTable(
320318
$temporaryTable,
321319
$this->dimensionTableMaintainer->getMainReplicaTable($dimensions)
322320
);
321+
$this->_defaultIndexerResource->getConnection()->dropTable($temporaryTable);
323322
}
324323
}
325324

@@ -354,7 +353,6 @@ private function reindexBatch(PriceInterface $priceIndexer, Select $batch): void
354353
if (!empty($entityIds)) {
355354
// Temporary table will created if not exists
356355
$idxTableName = $this->_defaultIndexerResource->getIdxTable();
357-
$this->_emptyTable($idxTableName);
358356

359357
if ($priceIndexer->getIsComposite()) {
360358
$this->_copyRelationIndexData($entityIds);
@@ -489,6 +487,7 @@ private function moveDataFromReplicaTableToReplicaTables(array $dimensions): voi
489487
* Retrieves the index table that should be used
490488
*
491489
* @deprecated 102.0.6
490+
* @see only used in another deprecated method: _copyRelationIndexData
492491
*/
493492
protected function getIndexTargetTable(): string
494493
{
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* ADOBE CONFIDENTIAL
5+
* ___________________
6+
*
7+
* Copyright 2014 Adobe
8+
* All Rights Reserved.
9+
*
10+
* NOTICE: All information contained herein is, and remains
11+
* the property of Adobe and its suppliers, if any. The intellectual
12+
* and technical concepts contained herein are proprietary to Adobe
13+
* and its suppliers and are protected by all applicable intellectual
14+
* property laws, including trade secret and copyright laws.
15+
* Dissemination of this information or reproduction of this material
16+
* is strictly forbidden unless prior written permission is obtained
17+
* from Adobe.
18+
* ************************************************************************
19+
*/
20+
declare(strict_types=1);
21+
22+
namespace Magento\Catalog\Model\Product\Attribute;
23+
24+
use Magento\Catalog\Api\ProductAttributeIsFilterableManagementInterface;
25+
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
26+
27+
class IsFilterableManagement implements ProductAttributeIsFilterableManagementInterface
28+
{
29+
/**
30+
* @var ProductAttributeRepositoryInterface
31+
*/
32+
private ProductAttributeRepositoryInterface $productAttributeRepository;
33+
34+
/**
35+
* @param ProductAttributeRepositoryInterface $productAttributeRepository
36+
*/
37+
public function __construct(
38+
ProductAttributeRepositoryInterface $productAttributeRepository
39+
) {
40+
$this->productAttributeRepository = $productAttributeRepository;
41+
}
42+
43+
/**
44+
* @inheritdoc
45+
*/
46+
public function get(string $attributeCode): int
47+
{
48+
$attribute = $this->productAttributeRepository->get($attributeCode);
49+
50+
return (int)$attribute->getIsFilterable();
51+
}
52+
53+
/**
54+
* @inheritdoc
55+
*/
56+
public function set(string $attributeCode, int $isFilterable): bool
57+
{
58+
$attribute = $this->productAttributeRepository->get($attributeCode);
59+
$attribute->setIsFilterable($isFilterable);
60+
$this->productAttributeRepository->save($attribute);
61+
62+
return true;
63+
}
64+
}

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/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
122122
$query = $select->crossUpdateFromSelect(['i' => $finalPriceTable]);
123123
$connection->query($query);
124124

125-
$connection->delete($coaTable);
126-
$connection->delete($copTable);
125+
$connection->dropTemporaryTable($coaTable);
126+
$connection->dropTemporaryTable($copTable);
127127
}
128128

129129
/**

0 commit comments

Comments
 (0)