Skip to content

Commit 897069b

Browse files
Merge branch 2.3-develop into ENGCOM-3835-magento-magento2-20224
2 parents 4bf0c4b + 9c36f6f commit 897069b

File tree

86 files changed

+2669
-272
lines changed

Some content is hidden

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

86 files changed

+2669
-272
lines changed

app/code/Magento/Backend/etc/module.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<module name="Magento_Backend">
1010
<sequence>
1111
<module name="Magento_Directory"/>
12+
<module name="Magento_Theme"/>
1213
</sequence>
1314
</module>
1415
</config>

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_listing.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
-->
88
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
9+
<listingToolbar name="listing_top" />
910
<columns name="design_config_columns">
1011
<column name="theme_theme_id" component="Magento_Ui/js/grid/columns/select" sortOrder="40">
1112
<settings>

app/code/Magento/Braintree/view/adminhtml/templates/form/cc.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $ccType = $block->getInfoData('cc_type');
8383
id="<?= /* @noEscape */ $code ?>_vault"
8484
name="payment[is_active_payment_token_enabler]"
8585
class="admin__control-checkbox"/>
86-
<label class="label" for="<?= /* @noEscape */ $code ?>_vault">
86+
<label class="label admin__field-label" for="<?= /* @noEscape */ $code ?>_vault">
8787
<span><?= $block->escapeHtml(__('Save for later use.')) ?></span>
8888
</label>
8989
</div>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Bundle\Model\Plugin\Frontend;
9+
10+
use Magento\Bundle\Model\Product\Type;
11+
use Magento\Catalog\Model\Product as CatalogProduct;
12+
13+
/**
14+
* Add child identities to product identities on storefront.
15+
*/
16+
class Product
17+
{
18+
/**
19+
* @var Type
20+
*/
21+
private $type;
22+
23+
/**
24+
* @param Type $type
25+
*/
26+
public function __construct(Type $type)
27+
{
28+
$this->type = $type;
29+
}
30+
31+
/**
32+
* Add child identities to product identities
33+
*
34+
* @param CatalogProduct $product
35+
* @param array $identities
36+
* @return array
37+
*/
38+
public function afterGetIdentities(CatalogProduct $product, array $identities): array
39+
{
40+
foreach ($this->type->getChildrenIds($product->getEntityId()) as $childIds) {
41+
foreach ($childIds as $childId) {
42+
$identities[] = CatalogProduct::CACHE_TAG . '_' . $childId;
43+
}
44+
}
45+
46+
return array_unique($identities);
47+
}
48+
}

app/code/Magento/Bundle/Setup/Patch/Data/UpdateBundleRelatedEntityTytpes.php renamed to app/code/Magento/Bundle/Setup/Patch/Data/UpdateBundleRelatedEntityTypes.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77
namespace Magento\Bundle\Setup\Patch\Data;
88

9+
use Magento\Catalog\Api\Data\ProductAttributeInterface;
10+
use Magento\Eav\Setup\EavSetup;
911
use Magento\Eav\Setup\EavSetupFactory;
10-
use Magento\Framework\App\ResourceConnection;
1112
use Magento\Framework\Setup\ModuleDataSetupInterface;
1213
use Magento\Framework\Setup\Patch\DataPatchInterface;
1314
use Magento\Framework\Setup\Patch\PatchVersionInterface;
14-
use Magento\Catalog\Api\Data\ProductAttributeInterface;
15-
use Magento\Eav\Setup\EavSetup;
1615

1716
/**
18-
* Class UpdateBundleRelatedEntityTytpes
17+
* Class UpdateBundleRelatedEntityTypes
18+
*
1919
* @package Magento\Bundle\Setup\Patch
2020
*/
21-
class UpdateBundleRelatedEntityTytpes implements DataPatchInterface, PatchVersionInterface
21+
class UpdateBundleRelatedEntityTypes implements DataPatchInterface, PatchVersionInterface
2222
{
2323
/**
2424
* @var ModuleDataSetupInterface
@@ -31,7 +31,7 @@ class UpdateBundleRelatedEntityTytpes implements DataPatchInterface, PatchVersio
3131
private $eavSetupFactory;
3232

3333
/**
34-
* UpdateBundleRelatedEntityTytpes constructor.
34+
* UpdateBundleRelatedEntityTypes constructor.
3535
* @param ModuleDataSetupInterface $moduleDataSetup
3636
* @param EavSetupFactory $eavSetupFactory
3737
*/
@@ -44,7 +44,7 @@ public function __construct(
4444
}
4545

4646
/**
47-
* {@inheritdoc}
47+
* @inheritdoc
4848
*/
4949
public function apply()
5050
{
@@ -177,7 +177,7 @@ private function upgradeShipmentType(EavSetup $eavSetup)
177177
}
178178

179179
/**
180-
* {@inheritdoc}
180+
* @inheritdoc
181181
*/
182182
public static function getDependencies()
183183
{
@@ -187,15 +187,15 @@ public static function getDependencies()
187187
}
188188

189189
/**
190-
* {@inheritdoc}
190+
* @inheritdoc
191191
*/
192192
public static function getVersion()
193193
{
194194
return '2.0.2';
195195
}
196196

197197
/**
198-
* {@inheritdoc}
198+
* @inheritdoc
199199
*/
200200
public function getAliases()
201201
{
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Unit\Model\Plugin\Frontend;
8+
9+
use Magento\Bundle\Model\Plugin\Frontend\Product as ProductPlugin;
10+
use Magento\Bundle\Model\Product\Type;
11+
use Magento\Catalog\Model\Product;
12+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
13+
14+
class ProductTest extends \PHPUnit\Framework\TestCase
15+
{
16+
/** @var \Magento\Bundle\Model\Plugin\Product */
17+
private $plugin;
18+
19+
/** @var MockObject|Type */
20+
private $type;
21+
22+
/** @var MockObject|\Magento\Catalog\Model\Product */
23+
private $product;
24+
25+
protected function setUp()
26+
{
27+
$this->product = $this->getMockBuilder(Product::class)
28+
->disableOriginalConstructor()
29+
->setMethods(['getEntityId'])
30+
->getMock();
31+
32+
$this->type = $this->getMockBuilder(Type::class)
33+
->disableOriginalConstructor()
34+
->setMethods(['getChildrenIds'])
35+
->getMock();
36+
37+
$this->plugin = new ProductPlugin($this->type);
38+
}
39+
40+
public function testAfterGetIdentities()
41+
{
42+
$baseIdentities = [
43+
'SomeCacheId',
44+
'AnotherCacheId',
45+
];
46+
$id = 12345;
47+
$childIds = [
48+
1 => [1, 2, 5, 100500],
49+
12 => [7, 22, 45, 24612]
50+
];
51+
$expectedIdentities = [
52+
'SomeCacheId',
53+
'AnotherCacheId',
54+
Product::CACHE_TAG . '_' . 1,
55+
Product::CACHE_TAG . '_' . 2,
56+
Product::CACHE_TAG . '_' . 5,
57+
Product::CACHE_TAG . '_' . 100500,
58+
Product::CACHE_TAG . '_' . 7,
59+
Product::CACHE_TAG . '_' . 22,
60+
Product::CACHE_TAG . '_' . 45,
61+
Product::CACHE_TAG . '_' . 24612,
62+
];
63+
$this->product->expects($this->once())
64+
->method('getEntityId')
65+
->will($this->returnValue($id));
66+
$this->type->expects($this->once())
67+
->method('getChildrenIds')
68+
->with($id)
69+
->will($this->returnValue($childIds));
70+
$identities = $this->plugin->afterGetIdentities($this->product, $baseIdentities);
71+
$this->assertEquals($expectedIdentities, $identities);
72+
}
73+
}

app/code/Magento/Bundle/etc/frontend/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
</argument>
1414
</arguments>
1515
</type>
16+
<type name="Magento\Catalog\Model\Product">
17+
<plugin name="bundle" type="Magento\Bundle\Model\Plugin\Frontend\Product" sortOrder="100" />
18+
</type>
1619
</config>

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Related.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ protected function _prepareColumns()
322322
}
323323

324324
/**
325-
* Rerieve grid URL
325+
* Retrieve grid URL
326326
*
327327
* @return string
328328
*/

app/code/Magento/Catalog/Model/Layer/Filter/Item/DataBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
namespace Magento\Catalog\Model\Layer\Filter\Item;
8+
79
/**
810
* Item Data Builder
911
*/
10-
namespace Magento\Catalog\Model\Layer\Filter\Item;
11-
1212
class DataBuilder
1313
{
1414
/**
@@ -29,7 +29,7 @@ class DataBuilder
2929
* Add Item Data
3030
*
3131
* @param string $label
32-
* @param string $label
32+
* @param string $value
3333
* @param int $count
3434
* @return void
3535
*/

app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,20 @@ class DefaultValidator extends \Magento\Framework\Validator\AbstractValidator
2828
*/
2929
protected $priceTypes;
3030

31+
/**
32+
* @var \Magento\Framework\Locale\FormatInterface
33+
*/
34+
private $localeFormat;
35+
3136
/**
3237
* @param \Magento\Catalog\Model\ProductOptions\ConfigInterface $productOptionConfig
3338
* @param \Magento\Catalog\Model\Config\Source\Product\Options\Price $priceConfig
39+
* @param \Magento\Framework\Locale\FormatInterface|null $localeFormat
3440
*/
3541
public function __construct(
3642
\Magento\Catalog\Model\ProductOptions\ConfigInterface $productOptionConfig,
37-
\Magento\Catalog\Model\Config\Source\Product\Options\Price $priceConfig
43+
\Magento\Catalog\Model\Config\Source\Product\Options\Price $priceConfig,
44+
\Magento\Framework\Locale\FormatInterface $localeFormat = null
3845
) {
3946
foreach ($productOptionConfig->getAll() as $option) {
4047
foreach ($option['types'] as $type) {
@@ -45,6 +52,9 @@ public function __construct(
4552
foreach ($priceConfig->toOptionArray() as $item) {
4653
$this->priceTypes[] = $item['value'];
4754
}
55+
56+
$this->localeFormat = $localeFormat ?: \Magento\Framework\App\ObjectManager::getInstance()
57+
->get(\Magento\Framework\Locale\FormatInterface::class);
4858
}
4959

5060
/**
@@ -137,11 +147,11 @@ protected function validateOptionType(Option $option)
137147
*/
138148
protected function validateOptionValue(Option $option)
139149
{
140-
return $this->isInRange($option->getPriceType(), $this->priceTypes);
150+
return $this->isInRange($option->getPriceType(), $this->priceTypes) && $this->isNumber($option->getPrice());
141151
}
142152

143153
/**
144-
* Check whether value is empty
154+
* Check whether the value is empty
145155
*
146156
* @param mixed $value
147157
* @return bool
@@ -152,7 +162,7 @@ protected function isEmpty($value)
152162
}
153163

154164
/**
155-
* Check whether value is in range
165+
* Check whether the value is in range
156166
*
157167
* @param string $value
158168
* @param array $range
@@ -164,13 +174,24 @@ protected function isInRange($value, array $range)
164174
}
165175

166176
/**
167-
* Check whether value is not negative
177+
* Check whether the value is negative
168178
*
169179
* @param string $value
170180
* @return bool
171181
*/
172182
protected function isNegative($value)
173183
{
174-
return (int) $value < 0;
184+
return $this->localeFormat->getNumber($value) < 0;
185+
}
186+
187+
/**
188+
* Check whether the value is a number
189+
*
190+
* @param string $value
191+
* @return bool
192+
*/
193+
public function isNumber($value)
194+
{
195+
return is_numeric($this->localeFormat->getNumber($value));
175196
}
176197
}

app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
use Magento\Catalog\Model\Product\Option;
1010

11+
/**
12+
* Select validator class
13+
*/
1114
class Select extends DefaultValidator
1215
{
1316
/**
@@ -83,7 +86,7 @@ protected function isValidOptionPrice($priceType, $price, $storeId)
8386
if (!$priceType && !$price) {
8487
return true;
8588
}
86-
if (!$this->isInRange($priceType, $this->priceTypes)) {
89+
if (!$this->isInRange($priceType, $this->priceTypes) || !$this->isNumber($price)) {
8790
return false;
8891
}
8992

0 commit comments

Comments
 (0)