Skip to content

Commit 9a1da8a

Browse files
Merge branch '2.4-develop' into refactor/wishlist
2 parents 2f08064 + 735579d commit 9a1da8a

File tree

25 files changed

+450
-78
lines changed

25 files changed

+450
-78
lines changed

app/code/Magento/CatalogGraphQl/Model/ProductLinksTypeResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
1111

1212
/**
13-
* {@inheritdoc}
13+
* @inheritdoc
1414
*/
1515
class ProductLinksTypeResolver implements TypeResolverInterface
1616
{
@@ -20,9 +20,9 @@ class ProductLinksTypeResolver implements TypeResolverInterface
2020
private $linkTypes = ['related', 'upsell', 'crosssell'];
2121

2222
/**
23-
* {@inheritdoc}
23+
* @inheritdoc
2424
*/
25-
public function resolveType(array $data) : string
25+
public function resolveType(array $data): string
2626
{
2727
if (isset($data['link_type'])) {
2828
$linkType = $data['link_type'];

app/code/Magento/CatalogGraphQl/Model/Resolver/Product/BatchProductLinks.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ class BatchProductLinks implements BatchServiceContractResolverInterface
2222
/**
2323
* @var string[]
2424
*/
25-
private static $linkTypes = ['related', 'upsell', 'crosssell'];
25+
private $linkTypes;
26+
27+
/**
28+
* @param array $linkTypes
29+
*/
30+
public function __construct(array $linkTypes)
31+
{
32+
$this->linkTypes = $linkTypes;
33+
}
2634

2735
/**
2836
* @inheritDoc
@@ -44,7 +52,7 @@ public function convertToServiceArgument(ResolveRequestInterface $request)
4452
/** @var \Magento\Catalog\Model\Product $product */
4553
$product = $value['model'];
4654

47-
return new ListCriteria((string)$product->getId(), self::$linkTypes, $product);
55+
return new ListCriteria((string)$product->getId(), $this->linkTypes, $product);
4856
}
4957

5058
/**

app/code/Magento/CatalogGraphQl/etc/di.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,14 @@
7474
<preference type="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\Provider" for="\Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderInterface"/>
7575

7676
<preference type="Magento\CatalogGraphQl\Model\Resolver\Products\Query\Search" for="Magento\CatalogGraphQl\Model\Resolver\Products\Query\ProductQueryInterface"/>
77+
78+
<type name="\Magento\CatalogGraphQl\Model\Resolver\Product\BatchProductLinks">
79+
<arguments>
80+
<argument name="linkTypes" xsi:type="array">
81+
<item name="related" xsi:type="string">related</item>
82+
<item name="upsell" xsi:type="string">upsell</item>
83+
<item name="crosssell" xsi:type="string">crosssell</item>
84+
</argument>
85+
</arguments>
86+
</type>
7787
</config>

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,7 @@ protected function _saveProducts()
15951595
}
15961596

15971597
$rowSku = $rowData[self::COL_SKU];
1598+
$rowSkuNormalized = mb_strtolower($rowSku);
15981599

15991600
if (null === $rowSku) {
16001601
$this->getErrorAggregator()->addRowToSkip($rowNum);
@@ -1604,9 +1605,9 @@ protected function _saveProducts()
16041605
$storeId = !empty($rowData[self::COL_STORE])
16051606
? $this->getStoreIdByCode($rowData[self::COL_STORE])
16061607
: Store::DEFAULT_STORE_ID;
1607-
$rowExistingImages = $existingImages[$storeId][$rowSku] ?? [];
1608+
$rowExistingImages = $existingImages[$storeId][$rowSkuNormalized] ?? [];
16081609
$rowStoreMediaGalleryValues = $rowExistingImages;
1609-
$rowExistingImages += $existingImages[Store::DEFAULT_STORE_ID][$rowSku] ?? [];
1610+
$rowExistingImages += $existingImages[Store::DEFAULT_STORE_ID][$rowSkuNormalized] ?? [];
16101611

16111612
if (self::SCOPE_STORE == $rowScope) {
16121613
// set necessary data from SCOPE_DEFAULT row
@@ -1762,10 +1763,11 @@ protected function _saveProducts()
17621763
continue;
17631764
}
17641765

1765-
if (isset($rowExistingImages[$uploadedFile])) {
1766-
$currentFileData = $rowExistingImages[$uploadedFile];
1766+
$uploadedFileNormalized = ltrim($uploadedFile, '/\\');
1767+
if (isset($rowExistingImages[$uploadedFileNormalized])) {
1768+
$currentFileData = $rowExistingImages[$uploadedFileNormalized];
17671769
$currentFileData['store_id'] = $storeId;
1768-
$storeMediaGalleryValueExists = isset($rowStoreMediaGalleryValues[$uploadedFile]);
1770+
$storeMediaGalleryValueExists = isset($rowStoreMediaGalleryValues[$uploadedFileNormalized]);
17691771
if (array_key_exists($uploadedFile, $imageHiddenStates)
17701772
&& $currentFileData['disabled'] != $imageHiddenStates[$uploadedFile]
17711773
) {

app/code/Magento/CatalogImportExport/Model/Import/Product/MediaGalleryProcessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ public function getExistingImages(array $bunch)
384384
foreach ($this->connection->fetchAll($select) as $image) {
385385
$storeId = $image['store_id'];
386386
unset($image['store_id']);
387-
$result[$storeId][$image['sku']][$image['value']] = $image;
387+
$sku = mb_strtolower($image['sku']);
388+
$value = ltrim($image['value'], '/\\');
389+
$result[$storeId][$sku][$value] = $image;
388390
}
389391

390392
return $result;

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Converter implements ConverterInterface
1919
*/
2020
private const ES_DATA_TYPE_TEXT = 'text';
2121
private const ES_DATA_TYPE_KEYWORD = 'keyword';
22-
private const ES_DATA_TYPE_FLOAT = 'float';
22+
private const ES_DATA_TYPE_DOUBLE = 'double';
2323
private const ES_DATA_TYPE_INT = 'integer';
2424
private const ES_DATA_TYPE_DATE = 'date';
2525
/**#@-*/
@@ -32,7 +32,7 @@ class Converter implements ConverterInterface
3232
private $mapping = [
3333
self::INTERNAL_DATA_TYPE_STRING => self::ES_DATA_TYPE_TEXT,
3434
self::INTERNAL_DATA_TYPE_KEYWORD => self::ES_DATA_TYPE_KEYWORD,
35-
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,
35+
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
3636
self::INTERNAL_DATA_TYPE_INT => self::ES_DATA_TYPE_INT,
3737
self::INTERNAL_DATA_TYPE_DATE => self::ES_DATA_TYPE_DATE,
3838
];

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public function addFieldsMapping(array $fields, $index, $entityType)
276276
'match' => 'price_*',
277277
'match_mapping_type' => 'string',
278278
'mapping' => [
279-
'type' => 'float',
279+
'type' => 'double',
280280
'store' => true,
281281
],
282282
],

app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Converter implements ConverterInterface
1616
* Text flags for Elasticsearch field types
1717
*/
1818
private const ES_DATA_TYPE_STRING = 'string';
19-
private const ES_DATA_TYPE_FLOAT = 'float';
19+
private const ES_DATA_TYPE_DOUBLE = 'double';
2020
private const ES_DATA_TYPE_INT = 'integer';
2121
private const ES_DATA_TYPE_DATE = 'date';
2222
/**#@-*/
@@ -29,7 +29,7 @@ class Converter implements ConverterInterface
2929
private $mapping = [
3030
self::INTERNAL_DATA_TYPE_STRING => self::ES_DATA_TYPE_STRING,
3131
self::INTERNAL_DATA_TYPE_KEYWORD => self::ES_DATA_TYPE_STRING,
32-
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_FLOAT,
32+
self::INTERNAL_DATA_TYPE_FLOAT => self::ES_DATA_TYPE_DOUBLE,
3333
self::INTERNAL_DATA_TYPE_INT => self::ES_DATA_TYPE_INT,
3434
self::INTERNAL_DATA_TYPE_DATE => self::ES_DATA_TYPE_DATE,
3535
];
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Elasticsearch\Setup\Patch\Data;
10+
11+
use Magento\Framework\Setup\ModuleDataSetupInterface;
12+
use Magento\Framework\Setup\Patch\DataPatchInterface;
13+
use Magento\Framework\Indexer\IndexerRegistry;
14+
use Magento\CatalogSearch\Model\Indexer\Fulltext as FulltextIndexer;
15+
use Magento\Framework\Setup\Patch\PatchInterface;
16+
17+
/**
18+
* Invalidate fulltext index
19+
*/
20+
class InvalidateIndex implements DataPatchInterface
21+
{
22+
/**
23+
* @var ModuleDataSetupInterface
24+
*/
25+
private $moduleDataSetup;
26+
27+
/**
28+
* @var IndexerRegistry
29+
*/
30+
private $indexerRegistry;
31+
32+
/**
33+
* @param ModuleDataSetupInterface $moduleDataSetup
34+
* @param IndexerRegistry $indexerRegistry
35+
*/
36+
public function __construct(ModuleDataSetupInterface $moduleDataSetup, IndexerRegistry $indexerRegistry)
37+
{
38+
$this->moduleDataSetup = $moduleDataSetup;
39+
$this->indexerRegistry = $indexerRegistry;
40+
}
41+
42+
/**
43+
* @inheritDoc
44+
*/
45+
public function apply(): PatchInterface
46+
{
47+
$this->indexerRegistry->get(FulltextIndexer::INDEXER_ID)->invalidate();
48+
return $this;
49+
}
50+
51+
/**
52+
* @inheritDoc
53+
*/
54+
public static function getDependencies(): array
55+
{
56+
return [];
57+
}
58+
59+
/**
60+
* @inheritDoc
61+
*/
62+
public function getAliases(): array
63+
{
64+
return [];
65+
}
66+
}

app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function testAddFieldsMapping()
329329
'match' => 'price_*',
330330
'match_mapping_type' => 'string',
331331
'mapping' => [
332-
'type' => 'float',
332+
'type' => 'double',
333333
'store' => true,
334334
],
335335
],
@@ -400,7 +400,7 @@ public function testAddFieldsMappingFailure()
400400
'match' => 'price_*',
401401
'match_mapping_type' => 'string',
402402
'mapping' => [
403-
'type' => 'float',
403+
'type' => 'double',
404404
'store' => true,
405405
],
406406
],

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/DynamicFieldTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function ($type) use ($complexType) {
246246
if ($type === 'string') {
247247
return 'string';
248248
} elseif ($type === 'float') {
249-
return 'float';
249+
return 'double';
250250
} elseif ($type === 'integer') {
251251
return 'integer';
252252
} else {
@@ -281,7 +281,7 @@ public function attributeProvider()
281281
'index' => 'no_index'
282282
],
283283
'price_1_1' => [
284-
'type' => 'float',
284+
'type' => 'double',
285285
'store' => true
286286
]
287287
]
@@ -300,7 +300,7 @@ public function attributeProvider()
300300
'index' => 'no_index'
301301
],
302302
'price_1_1' => [
303-
'type' => 'float',
303+
'type' => 'double',
304304
'store' => true
305305
]
306306
],
@@ -319,7 +319,7 @@ public function attributeProvider()
319319
'index' => 'no_index'
320320
],
321321
'price_1_1' => [
322-
'type' => 'float',
322+
'type' => 'double',
323323
'store' => true
324324
]
325325
]

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/ConverterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function convertProvider()
5656
{
5757
return [
5858
['string', 'string'],
59-
['float', 'float'],
59+
['float', 'double'],
6060
['integer', 'integer'],
6161
];
6262
}

app/code/Magento/Elasticsearch6/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public function addFieldsMapping(array $fields, $index, $entityType)
281281
'match' => 'price_*',
282282
'match_mapping_type' => 'string',
283283
'mapping' => [
284-
'type' => 'float',
284+
'type' => 'double',
285285
'store' => true,
286286
],
287287
],

app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ public function testAddFieldsMapping()
439439
'match' => 'price_*',
440440
'match_mapping_type' => 'string',
441441
'mapping' => [
442-
'type' => 'float',
442+
'type' => 'double',
443443
'store' => true,
444444
],
445445
],
@@ -509,7 +509,7 @@ public function testAddFieldsMappingFailure()
509509
'match' => 'price_*',
510510
'match_mapping_type' => 'string',
511511
'mapping' => [
512-
'type' => 'float',
512+
'type' => 'double',
513513
'store' => true,
514514
],
515515
],

app/code/Magento/Elasticsearch7/Model/Client/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public function addFieldsMapping(array $fields, string $index, string $entityTyp
289289
'match' => 'price_*',
290290
'match_mapping_type' => 'string',
291291
'mapping' => [
292-
'type' => 'float',
292+
'type' => 'double',
293293
'store' => true,
294294
],
295295
],

app/code/Magento/Elasticsearch7/Test/Unit/Model/Client/ElasticsearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public function testAddFieldsMapping()
438438
'match' => 'price_*',
439439
'match_mapping_type' => 'string',
440440
'mapping' => [
441-
'type' => 'float',
441+
'type' => 'double',
442442
'store' => true,
443443
],
444444
],
@@ -509,7 +509,7 @@ public function testAddFieldsMappingFailure()
509509
'match' => 'price_*',
510510
'match_mapping_type' => 'string',
511511
'mapping' => [
512-
'type' => 'float',
512+
'type' => 'double',
513513
'store' => true,
514514
],
515515
],

app/code/Magento/GroupedProductGraphQl/Model/GroupedProductLinksTypeResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\GraphQl\Query\Resolver\TypeResolverInterface;
1111

1212
/**
13-
* {@inheritdoc}
13+
* @inheritdoc
1414
*/
1515
class GroupedProductLinksTypeResolver implements TypeResolverInterface
1616
{
@@ -20,14 +20,14 @@ class GroupedProductLinksTypeResolver implements TypeResolverInterface
2020
private $linkTypes = ['associated'];
2121

2222
/**
23-
* {@inheritdoc}
23+
* @inheritdoc
2424
*/
25-
public function resolveType(array $data) : string
25+
public function resolveType(array $data): string
2626
{
2727
if (isset($data['link_type'])) {
2828
$linkType = $data['link_type'];
2929
if (in_array($linkType, $this->linkTypes)) {
30-
return 'GroupedProductLinks';
30+
return 'ProductLinks';
3131
}
3232
}
3333
return '';

app/code/Magento/GroupedProductGraphQl/etc/di.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,11 @@
1313
</argument>
1414
</arguments>
1515
</type>
16+
<type name="\Magento\CatalogGraphQl\Model\Resolver\Product\BatchProductLinks">
17+
<arguments>
18+
<argument name="linkTypes" xsi:type="array">
19+
<item name="associated" xsi:type="string">associated</item>
20+
</argument>
21+
</arguments>
22+
</type>
1623
</config>

app/code/Magento/Payment/Block/Transparent/Redirect.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,21 @@ public function getRedirectUrl(): string
5353
/**
5454
* Returns params to be redirected.
5555
*
56+
* Encodes invalid UTF-8 values to UTF-8 to prevent character escape error.
57+
* Some payment methods like PayPal, send data in merchant defined language encoding
58+
* which can be different from the system character encoding (UTF-8).
59+
*
5660
* @return array
5761
*/
5862
public function getPostParams(): array
5963
{
60-
return (array)$this->_request->getPostValue();
64+
$params = [];
65+
foreach ($this->_request->getPostValue() as $name => $value) {
66+
if (!empty($value) && mb_detect_encoding($value, 'UTF-8', true) === false) {
67+
$value = utf8_encode($value);
68+
}
69+
$params[$name] = $value;
70+
}
71+
return $params;
6172
}
6273
}

0 commit comments

Comments
 (0)