Skip to content

Commit 7d5e390

Browse files
authored
Merge pull request #9373 from magento-gl/spartans_pr_19112024
[Spartans] Fixes Delivery
2 parents 40cd9ed + b8337a5 commit 7d5e390

File tree

27 files changed

+289
-130
lines changed

27 files changed

+289
-130
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -18,8 +18,6 @@
1818
<testCaseId value="MC-115"/>
1919
<group value="Bundle"/>
2020
<group value="cloud"/>
21-
<!-- Excluded from PR builds due to AC-12124 -->
22-
<group value="pr_exclude"/>
2321
</annotations>
2422
<before>
2523
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
33
*
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77

88
namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute;
@@ -269,6 +269,11 @@ public function execute()
269269

270270
unset($data['entity_type_id']);
271271

272+
if (array_key_exists('reset_is-default_option', $data) && $data['reset_is-default_option']) {
273+
unset($data['reset_is-default_option']);
274+
$data['default_value'] = null;
275+
}
276+
272277
$model->addData($data);
273278

274279
if (!$attributeId) {

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection/AttributePropertiesSection.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -34,5 +34,6 @@
3434
<element name="attributeLabelValidationError" type="text" selector=".field-attribute_label .mage-error"/>
3535
<element name="AttributeCode" type="input" selector="#attribute_code"/>
3636
<element name="defaultRadioButton" type="radio" selector="//*[@id='swatch_window_option_option_{{position}}']/parent::td/parent::tr/td[@class='col-default']" parameterized="true"/>
37+
<element name="resetDefaultSwatchVisualOptionButton" type="button" selector="#reset_default_swatch_visual_option_button" />
3738
</section>
3839
</sections>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductMediaSection.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -16,7 +16,7 @@
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']" />
1818
<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"/>
19+
<element name="imageFileInGallery" type="text" selector="//div[contains(@class, 'gallery-placeholder')]//img[contains(@src, '{{filename}}')]" parameterized="true"/>
2020
<element name="productImageActive" type="text" selector=".product.media div[data-active=true] > img[src*='{{filename}}']" parameterized="true"/>
2121
<element name="productImageInFotorama" type="file" selector=".fotorama__nav__shaft img[src*='{{imageName}}']" parameterized="true" timeout="30"/>
2222
<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/AdminAddRemoveProductImageVirtualProductTest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -18,8 +18,6 @@
1818
<testCaseId value="MC-103"/>
1919
<group value="Catalog"/>
2020
<group value="cloud"/>
21-
<!-- Excluded from PR builds due to AC-12124 -->
22-
<group value="pr_exclude"/>
2321
</annotations>
2422
<before>
2523
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest/AdminSimpleProductImagesTest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -16,8 +16,6 @@
1616
<severity value="BLOCKER"/>
1717
<testCaseId value="MC-189"/>
1818
<group value="Catalog"/>
19-
<!-- Excluded from PR builds due to AC-12124 -->
20-
<group value="pr_exclude"/>
2119
</annotations>
2220

2321
<before>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductImageWithDotTest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -17,8 +17,6 @@
1717
<group value="Catalog"/>
1818
<severity value="AVERAGE"/>
1919
<group value="cloud"/>
20-
<!-- Excluded from PR builds due to AC-12124 -->
21-
<group value="pr_exclude"/>
2220
</annotations>
2321
<before>
2422
<magentoCLI command="config:set system/upload_configuration/enable_resize 0" stepKey="disableImageResizing"/>

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

+33-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66

77
// phpcs:disable PHPCompatibility.Miscellaneous.RemovedAlternativePHPTags.MaybeASPOpenTagFound
8-
/** @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options */
8+
// phpcs:disable Generic.Files.LineLength.TooLong
9+
/**
10+
* @var $block \Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\Options
11+
* @var \Magento\Framework\Escaper $escaper
12+
*/
13+
914

1015
$stores = $block->getStoresSortedBySortOrder();
1116
?>
1217
<fieldset class="admin__fieldset fieldset">
1318
<legend class="legend">
14-
<span><?= $block->escapeHtml(__('Manage Options (Values of Your Attribute)')) ?></span>
19+
<span><?= $escaper->escapeHtml(__('Manage Options (Values of Your Attribute)')) ?></span>
1520
</legend><br />
1621
<div class="admin__control-table-wrapper" id="manage-options-panel" data-index="attribute_options_select_container">
1722
<table class="admin__control-table" data-index="attribute_options_select">
1823
<thead>
1924
<tr id="attribute-options-table">
2025
<th class="col-draggable"></th>
2126
<th class="col-default control-table-actions-th">
22-
<span><?= $block->escapeHtml(__('Is Default')) ?></span>
27+
<span><?= $escaper->escapeHtml(__('Is Default')) ?></span>
2328
</th>
2429
<?php
25-
foreach ($stores as $_store) :?>
26-
<th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> class="_required"<?php endif; ?>>
27-
<span><?= $block->escapeHtml(__($_store->getName())) ?></span>
30+
foreach ($stores as $_store):?>
31+
<th<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID):?> class="_required"<?php endif; ?>>
32+
<span><?= $escaper->escapeHtml(__($_store->getName())) ?></span>
2833
</th>
2934
<?php endforeach;
3035
$storetotal = count($stores) + 3;
@@ -38,15 +43,22 @@ $stores = $block->getStoresSortedBySortOrder();
3843
<th colspan="<?= (int)$storetotal ?>" class="validation">
3944
<input type="hidden" class="required-dropdown-attribute-entry" name="dropdown_attribute_validation"/>
4045
<input type="hidden" class="required-dropdown-attribute-unique" name="dropdown_attribute_validation_unique"/>
46+
<input type="hidden" name="reset_is-default_option"/>
4147
</th>
4248
</tr>
4349
<tr>
4450
<th colspan="<?= (int) $storetotal ?>" class="col-actions-add">
45-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?>
51+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
4652
<button id="add_new_option_button" data-action="add_new_row"
47-
title="<?= $block->escapeHtml(__('Add Option')) ?>"
53+
title="<?= $escaper->escapeHtml(__('Add Option')) ?>"
4854
type="button" class="action- scalable add">
49-
<span><?= $block->escapeHtml(__('Add Option')) ?></span>
55+
<span><?= $escaper->escapeHtml(__('Add Option')) ?></span>
56+
</button>
57+
58+
<button id="reset_default_options_option_button"
59+
title="<?= $escaper->escapeHtml(__('Reset Is Default')) ?>"
60+
type="button" class="action- scalable reset">
61+
<span><?= $escaper->escapeHtml(__('Reset Is Default')) ?></span>
5062
</button>
5163
<?php endif; ?>
5264
</th>
@@ -58,26 +70,26 @@ $stores = $block->getStoresSortedBySortOrder();
5870
<script id="row-template" type="text/x-magento-template">
5971
<tr <% if (data.rowClasses) { %>class="<%- data.rowClasses %>"<% } %>>
6072
<td class="col-draggable">
61-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?>
73+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
6274
<div data-role="draggable-handle" class="draggable-handle"
63-
title="<?= $block->escapeHtml(__('Sort Option')) ?>">
75+
title="<?= $escaper->escapeHtml(__('Sort Option')) ?>">
6476
</div>
6577
<?php endif; ?>
66-
<input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif; ?>/>
78+
<input data-role="order" type="hidden" name="option[order][<%- data.id %>]" value="<%- data.sort_order %>" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif; ?>/>
6779
</td>
6880
<td class="col-default control-table-actions-cell">
69-
<input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()) :?>disabled="disabled"<?php endif;?>/>
81+
<input class="input-radio" type="<%- data.intype %>" name="default[]" value="<%- data.id %>" <%- data.checked %><?php if ($block->getReadOnly()):?>disabled="disabled"<?php endif;?>/>
7082
</td>
71-
<?php foreach ($stores as $_store) :?>
72-
<td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID) :?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()) :?> disabled="disabled"<?php endif;?>/></td>
83+
<?php foreach ($stores as $_store):?>
84+
<td class="col-<%- data.id %>"><input name="option[value][<%- data.id %>][<?= (int) $_store->getId() ?>]" value="<%- data.store<?= /* @noEscape */ (int) $_store->getId() ?> %>" class="input-text<?php if ($_store->getId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID):?> required-option required-unique<?php endif; ?>" type="text" <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()):?> disabled="disabled"<?php endif;?>/></td>
7385
<?php endforeach; ?>
7486
<td id="delete_button_container_<%- data.id %>" class="col-delete">
7587
<input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" />
76-
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()) :?>
77-
<button id="delete_button_<%- data.id %>" title="<?= $block->escapeHtml(__('Delete')) ?>" type="button"
88+
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
89+
<button id="delete_button_<%- data.id %>" title="<?= $escaper->escapeHtml(__('Delete')) ?>" type="button"
7890
class="action- scalable delete delete-option"
7991
>
80-
<span><?= $block->escapeHtml(__('Delete')) ?></span>
92+
<span><?= $escaper->escapeHtml(__('Delete')) ?></span>
8193
</button>
8294
<?php endif;?>
8395
</td>
@@ -102,7 +114,7 @@ $stores = $block->getStoresSortedBySortOrder();
102114
},
103115
"Magento_Catalog/catalog/product/attribute/unique-validate": {
104116
"element": "required-dropdown-attribute-unique",
105-
"message": "<?= $block->escapeHtml(__("The value of Admin must be unique.")) ?>"
117+
"message": "<?= $escaper->escapeHtml(__("The value of Admin must be unique.")) ?>"
106118
}
107119
}
108120
}

app/code/Magento/Catalog/view/adminhtml/web/js/options.js

+18
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ define([
9494
element.remove();
9595
}
9696
},
97+
reset: function () {
98+
jQuery('input[name="default[]"]').prop('checked', false);
99+
jQuery('input[name="reset_is-default_option"]').val(1);
100+
},
101+
97102
updateItemsCountField: function () {
98103
$('option-count-check').value = this.totalItems > 0 ? '1' : '';
99104
},
@@ -106,6 +111,9 @@ define([
106111
bindRemoveButtons: function () {
107112
jQuery('#swatch-visual-options-panel').on('click', '.delete-option', this.remove.bind(this));
108113
},
114+
bindDefaultOptionChanges: function () {
115+
jQuery('#swatch-visual-options-panel').on('change', '.delete-option', this.remove.bind(this));
116+
},
109117
render: function () {
110118
Element.insert($$('[data-role=options-container]')[0], this.elements);
111119
this.elements = '';
@@ -151,6 +159,15 @@ define([
151159
if ($('add_new_option_button')) {
152160
Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption, {}, true));
153161
}
162+
163+
if ($('reset_default_options_option_button')) {
164+
Event.observe(
165+
'reset_default_options_option_button',
166+
'click',
167+
attributeOption.reset.bind(attributeOption, true)
168+
);
169+
}
170+
154171
$('manage-options-panel').on('click', '.delete-option', function (event) {
155172
attributeOption.remove(event);
156173
});
@@ -164,6 +181,7 @@ define([
164181
jQuery('body').trigger('processStart');
165182
attributeOption.renderWithDelay(config.attributesData, 0, 100, 300);
166183
attributeOption.bindRemoveButtons();
184+
attributeOption.bindDefaultOptionChanges();
167185
});
168186

169187
if (config.isSortable) {

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -18,8 +18,6 @@
1818
<testCaseId value="MC-101"/>
1919
<group value="ConfigurableProduct"/>
2020
<group value="cloud"/>
21-
<!-- Excluded from PR builds due to AC-12124 -->
22-
<group value="pr_exclude"/>
2321
</annotations>
2422

2523
<before>

app/code/Magento/Customer/Block/Account/Customer.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Customer\Block\Account;
77

@@ -40,6 +40,7 @@ public function __construct(
4040
) {
4141
parent::__construct($context, $data);
4242
$this->httpContext = $httpContext;
43+
$this->_isScopePrivate = true;
4344
}
4445

4546
/**

app/code/Magento/Customer/Model/Session.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -332,10 +332,8 @@ public function setCustomerId($id)
332332
*/
333333
public function getCustomerId()
334334
{
335-
if ($this->storage->getData('customer_id')) {
336-
return $this->storage->getData('customer_id');
337-
}
338-
return null;
335+
$customerId = $this->storage->getData('customer_id');
336+
return ($customerId && $this->checkCustomerId($customerId)) ? $customerId : null;
339337
}
340338

341339
/**

app/code/Magento/Customer/Test/Unit/Model/SessionTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -137,7 +137,7 @@ public function testSetCustomerAsLoggedIn(): void
137137
$this->_eventManagerMock
138138
->method('dispatch')
139139
->willReturnCallback(
140-
function ($arg1, $arg2) use ($customer, $customerDto, &$callCount) {
140+
function ($arg1, $arg2) use ($customer, $customerDto) {
141141
if ($arg1 == 'customer_login' && $arg2 == ['customer' => $customer]) {
142142
return null;
143143
} elseif ($arg1 == 'customer_data_object_login' && $arg2 == ['customer' => $customerDto]) {
@@ -316,7 +316,7 @@ public function testGetCustomerForRegisteredUser(): void
316316
->willReturn($customerMock);
317317

318318
$this->_storageMock
319-
->expects($this->exactly(4))
319+
->expects($this->exactly(2))
320320
->method('getData')
321321
->with('customer_id')
322322
->willReturn($customerId);

0 commit comments

Comments
 (0)