Skip to content

Commit 26b41af

Browse files
authored
Merge branch '2.4-develop' into cache-config-builder
2 parents cc2c5b9 + 02b87f6 commit 26b41af

File tree

16 files changed

+317
-36
lines changed

16 files changed

+317
-36
lines changed

app/code/Magento/Catalog/Model/Product/Price/Validation/Result.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ public function getFailedItems()
8383
}
8484
}
8585

86+
/**
87+
* Clear validation messages to prevent wrong validation for subsequent price update.
88+
* Work around for backward compatible changes.
89+
*/
90+
$this->failedItems = [];
91+
8692
return $failedItems;
8793
}
8894
}

app/code/Magento/Catalog/etc/db_schema.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@
138138
<index referenceId="CATALOG_PRODUCT_ENTITY_INT_STORE_ID" indexType="btree">
139139
<column name="store_id"/>
140140
</index>
141+
<index referenceId="CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID_STORE_ID_VALUE" indexType="btree">
142+
<column name="attribute_id"/>
143+
<column name="store_id"/>
144+
<column name="value"/>
145+
</index>
141146
</table>
142147
<table name="catalog_product_entity_text" resource="default" engine="innodb"
143148
comment="Catalog Product Text Attribute Backend Table">

app/code/Magento/Catalog/etc/db_schema_whitelist.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
},
7070
"index": {
7171
"CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID": true,
72-
"CATALOG_PRODUCT_ENTITY_INT_STORE_ID": true
72+
"CATALOG_PRODUCT_ENTITY_INT_STORE_ID": true,
73+
"CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE_ID_STORE_ID_VALUE": true
7374
},
7475
"constraint": {
7576
"PRIMARY": true,

app/code/Magento/Contact/view/frontend/templates/form.phtml

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

7+
// phpcs:disable Magento2.Templates.ThisInTemplate
8+
// phpcs:disable Generic.Files.LineLength.TooLong
9+
710
/** @var \Magento\Contact\Block\ContactForm $block */
811
/** @var \Magento\Contact\ViewModel\UserDataProvider $viewModel */
912

@@ -23,35 +26,35 @@ $viewModel = $block->getViewModel();
2326
<div class="field name required">
2427
<label class="label" for="name"><span><?= $block->escapeHtml(__('Name')) ?></span></label>
2528
<div class="control">
26-
<input name="name"
27-
id="name"
28-
title="<?= $block->escapeHtmlAttr(__('Name')) ?>"
29-
value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>"
30-
class="input-text"
31-
type="text"
29+
<input name="name"
30+
id="name"
31+
title="<?= $block->escapeHtmlAttr(__('Name')) ?>"
32+
value="<?= $block->escapeHtmlAttr($viewModel->getUserName()) ?>"
33+
class="input-text"
34+
type="text"
3235
data-validate="{required:true}"/>
3336
</div>
3437
</div>
3538
<div class="field email required">
3639
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
3740
<div class="control">
38-
<input name="email"
39-
id="email"
40-
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
41-
value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
42-
class="input-text"
43-
type="email"
41+
<input name="email"
42+
id="email"
43+
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
44+
value="<?= $block->escapeHtmlAttr($viewModel->getUserEmail()) ?>"
45+
class="input-text"
46+
type="email"
4447
data-validate="{required:true, 'validate-email':true}"/>
4548
</div>
4649
</div>
4750
<div class="field telephone">
4851
<label class="label" for="telephone"><span><?= $block->escapeHtml(__('Phone Number')) ?></span></label>
4952
<div class="control">
50-
<input name="telephone"
51-
id="telephone"
52-
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
53-
value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
54-
class="input-text"
53+
<input name="telephone"
54+
id="telephone"
55+
title="<?= $block->escapeHtmlAttr(__('Phone Number')) ?>"
56+
value="<?= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
57+
class="input-text"
5558
type="tel" />
5659
</div>
5760
</div>
@@ -60,12 +63,12 @@ $viewModel = $block->getViewModel();
6063
<span><?= $block->escapeHtml(__('What’s on your mind?')) ?></span>
6164
</label>
6265
<div class="control">
63-
<textarea name="comment"
64-
id="comment"
65-
title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>"
66-
class="input-text"
67-
cols="5"
68-
rows="3"
66+
<textarea name="comment"
67+
id="comment"
68+
title="<?= $block->escapeHtmlAttr(__('What’s on your mind?')) ?>"
69+
class="input-text"
70+
cols="5"
71+
rows="3"
6972
data-validate="{required:true}"><?= $block->escapeHtml($viewModel->getUserComment()) ?>
7073
</textarea>
7174
</div>
@@ -81,3 +84,12 @@ $viewModel = $block->getViewModel();
8184
</div>
8285
</div>
8386
</form>
87+
<script type="text/x-magento-init">
88+
{
89+
"*": {
90+
"Magento_Customer/js/block-submit-on-send": {
91+
"formId": "contact-form"
92+
}
93+
}
94+
}
95+
</script>

app/code/Magento/Customer/view/frontend/templates/form/forgotpassword.phtml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* @var $block \Magento\Customer\Block\Account\Forgotpassword
77
*/
88

9+
// phpcs:disable Generic.Files.LineLength.TooLong
10+
911
/** @var \Magento\Customer\Block\Account\Forgotpassword $block */
1012
?>
1113
<form class="form password forget"
@@ -32,3 +34,12 @@
3234
</div>
3335
</div>
3436
</form>
37+
<script type="text/x-magento-init">
38+
{
39+
"*": {
40+
"Magento_Customer/js/block-submit-on-send": {
41+
"formId": "form-validate"
42+
}
43+
}
44+
}
45+
</script>

app/code/Magento/Customer/view/frontend/templates/form/login.phtml

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

7+
// phpcs:disable Generic.Files.LineLength.TooLong
8+
79
/** @var \Magento\Customer\Block\Form\Login $block */
810
?>
911
<div class="block block-customer-login">
@@ -22,13 +24,22 @@
2224
<div class="field email required">
2325
<label class="label" for="email"><span><?= $block->escapeHtml(__('Email')) ?></span></label>
2426
<div class="control">
25-
<input name="login[username]" value="<?= $block->escapeHtmlAttr($block->getUsername()) ?>" <?php if ($block->isAutocompleteDisabled()) : ?> autocomplete="off"<?php endif; ?> id="email" type="email" class="input-text" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" data-mage-init='{"mage/trim-input":{}}' data-validate="{required:true, 'validate-email':true}">
27+
<input name="login[username]" value="<?= $block->escapeHtmlAttr($block->getUsername()) ?>"
28+
<?php if ($block->isAutocompleteDisabled()): ?> autocomplete="off"<?php endif; ?>
29+
id="email" type="email" class="input-text"
30+
title="<?= $block->escapeHtmlAttr(__('Email')) ?>"
31+
data-mage-init='{"mage/trim-input":{}}'
32+
data-validate="{required:true, 'validate-email':true}">
2633
</div>
2734
</div>
2835
<div class="field password required">
2936
<label for="pass" class="label"><span><?= $block->escapeHtml(__('Password')) ?></span></label>
3037
<div class="control">
31-
<input name="login[password]" type="password" <?php if ($block->isAutocompleteDisabled()) : ?> autocomplete="off"<?php endif; ?> class="input-text" id="pass" title="<?= $block->escapeHtmlAttr(__('Password')) ?>" data-validate="{required:true}">
38+
<input name="login[password]" type="password"
39+
<?php if ($block->isAutocompleteDisabled()): ?> autocomplete="off"<?php endif; ?>
40+
class="input-text" id="pass"
41+
title="<?= $block->escapeHtmlAttr(__('Password')) ?>"
42+
data-validate="{required:true}">
3243
</div>
3344
</div>
3445
<?= $block->getChildHtml('form_additional_info') ?>
@@ -41,3 +52,12 @@
4152
</div>
4253
</div>
4354

55+
<script type="text/x-magento-init">
56+
{
57+
"*": {
58+
"Magento_Customer/js/block-submit-on-send": {
59+
"formId": "login-form"
60+
}
61+
}
62+
}
63+
</script>

app/code/Magento/Customer/view/frontend/templates/form/register.phtml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,6 @@ require([
301301
ignore: ignore ? ':hidden:not(' + ignore + ')' : ':hidden'
302302
<?php endif ?>
303303
}).find('input:text').attr('autocomplete', 'off');
304-
dataForm.submit(function () {
305-
$(this).find(':submit').attr('disabled', 'disabled');
306-
});
307-
dataForm.bind("invalid-form.validate", function () {
308-
$(this).find(':submit').prop('disabled', false);
309-
});
310-
311304
});
312305
</script>
313306
<?php if ($block->getShowAddressFields()): ?>
@@ -337,6 +330,11 @@ require([
337330
"passwordStrengthIndicator": {
338331
"formSelector": "form.form-create-account"
339332
}
333+
},
334+
"*": {
335+
"Magento_Customer/js/block-submit-on-send": {
336+
"formId": "form-validate"
337+
}
340338
}
341339
}
342340
</script>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define([
7+
'jquery',
8+
'mage/mage'
9+
], function ($) {
10+
'use strict';
11+
12+
return function (config) {
13+
var dataForm = $('#' + config.formId);
14+
15+
dataForm.submit(function () {
16+
$(this).find(':submit').attr('disabled', 'disabled');
17+
});
18+
dataForm.bind('invalid-form.validate', function () {
19+
$(this).find(':submit').prop('disabled', false);
20+
});
21+
};
22+
});

app/code/Magento/GoogleOptimizer/Observer/AbstractSave.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,16 @@
55
* Copyright © Magento, Inc. All rights reserved.
66
* See COPYING.txt for license details.
77
*/
8+
declare(strict_types=1);
9+
810
namespace Magento\GoogleOptimizer\Observer;
911

1012
use Magento\Framework\Event\Observer;
1113
use Magento\Framework\Event\ObserverInterface;
1214

1315
/**
16+
* Abstract entity for saving codes
17+
*
1418
* @api
1519
* @since 100.0.2
1620
*/
@@ -96,7 +100,9 @@ protected function _processCode()
96100
$this->_initRequestParams();
97101

98102
if ($this->_isNewCode()) {
99-
$this->_saveCode();
103+
if (!$this->_isEmptyCode()) {
104+
$this->_saveCode();
105+
}
100106
} else {
101107
$this->_loadCode();
102108
if ($this->_isEmptyCode()) {
@@ -185,6 +191,8 @@ protected function _deleteCode()
185191
}
186192

187193
/**
194+
* Check data availability
195+
*
188196
* @return bool
189197
*/
190198
private function isDataAvailable()
@@ -194,6 +202,8 @@ private function isDataAvailable()
194202
}
195203

196204
/**
205+
* Get request data
206+
*
197207
* @return mixed
198208
*/
199209
private function getRequestData()

app/code/Magento/GoogleOptimizer/Test/Unit/Observer/Product/SaveGoogleExperimentScriptObserverTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,39 @@ public function testCreatingCodeIfRequestIsValid()
127127
$this->_modelObserver->execute($this->_eventObserverMock);
128128
}
129129

130+
/**
131+
* Test that code is not saving when request is empty
132+
*
133+
* @return void
134+
*/
135+
public function testCreatingCodeIfRequestIsEmpty(): void
136+
{
137+
$this->_helperMock->expects(
138+
$this->once()
139+
)->method(
140+
'isGoogleExperimentActive'
141+
)->with(
142+
$this->_storeId
143+
)->willReturn(
144+
true
145+
);
146+
147+
$this->_requestMock->expects(
148+
$this->exactly(3)
149+
)->method(
150+
'getParam'
151+
)->with(
152+
'google_experiment'
153+
)->willReturn(
154+
['code_id' => '', 'experiment_script' => '']
155+
);
156+
157+
$this->_codeMock->expects($this->never())->method('addData');
158+
$this->_codeMock->expects($this->never())->method('save');
159+
160+
$this->_modelObserver->execute($this->_eventObserverMock);
161+
}
162+
130163
/**
131164
* @param array $params
132165
* @dataProvider dataProviderWrongRequestForCreating

app/code/Magento/Newsletter/view/frontend/templates/subscribe.phtml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@
4040
</form>
4141
</div>
4242
</div>
43+
<script type="text/x-magento-init">
44+
{
45+
"*": {
46+
"Magento_Customer/js/block-submit-on-send": {
47+
"formId": "newsletter-validate-detail"
48+
}
49+
}
50+
}
51+
</script>

app/code/Magento/Quote/Model/Quote/Item/Processor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ public function prepare(Item $item, DataObject $request, Product $candidate): vo
9797
$item->addQty($candidate->getCartQty());
9898

9999
$customPrice = $request->getCustomPrice();
100-
$item->setPrice($candidate->getFinalPrice());
100+
if (!$item->getParentItem() || $item->getParentItem()->isChildrenCalculated()) {
101+
$item->setPrice($candidate->getFinalPrice());
102+
}
101103
if (!empty($customPrice)) {
102104
$item->setCustomPrice($customPrice);
103105
$item->setOriginalCustomPrice($customPrice);

0 commit comments

Comments
 (0)