Skip to content

Commit 6f03dd3

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop latest changes
Accepted Community Pull Requests: - #23774: #23705 : Css selector [role="button"] in related products javascript is not specific enough (by @konarshankar07) - #24140: Resolve "Action" column is not the last column in "Design Configuration" (issue 24139) (by @edenduong) - #24049: Fix: Update customer email in quote (by @UncleTioma) - #23690: Resolve API create /V1/products/attribute-sets/groups ("sort_order" and "attribute_group_code") not changing. (by @edenduong) - #24106: Resolve "Visibility" column in Review Grid should disable the "Sort" ability (issue 24105) (by @edenduong) - #20877: Improve bundle load speeds (by @thlassche) Fixed GitHub Issues: - #23705: Css selector [role="button"] in related products javascript is not specific enough (reported by @enr-beck) has been fixed in #23774 by @konarshankar07 in 2.3-develop branch Related commits: 1. 3bac25f - #24139: "Action" column is not the last column in "Design Configuration" (reported by @edenduong) has been fixed in #24140 by @edenduong in 2.3-develop branch Related commits: 1. 4e1a8aa - #24012: Customer email Address is not updated in quote and sales_order tables (reported by @dipak85shinde) has been fixed in #24049 by @UncleTioma in 2.3-develop branch Related commits: 1. 9177050 2. a62f72b 3. 7ef77d7 4. 766db37 5. b0ba2ac 6. e270394 7. cacbe13 - #23634: Eav Group Repository Order not changing. (reported by @LucianMihalache) has been fixed in #23690 by @edenduong in 2.3-develop branch Related commits: 1. 79410c8 - #24105: "Visibility" column in Review Grid should disable the "Sort" ability (reported by @edenduong) has been fixed in #24106 by @edenduong in 2.3-develop branch Related commits: 1. da8766f 2. 2cb86cb
2 parents 4b78a41 + 5e9755d commit 6f03dd3

File tree

10 files changed

+237
-34
lines changed

10 files changed

+237
-34
lines changed

app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
78

89
namespace Magento\Catalog\Model;
910

1011
use Magento\Framework\Exception\NoSuchEntityException;
1112
use Magento\Framework\Exception\StateException;
1213

14+
/**
15+
* Class \Magento\Catalog\Model\ProductAttributeGroupRepository
16+
*/
1317
class ProductAttributeGroupRepository implements \Magento\Catalog\Api\ProductAttributeGroupRepositoryInterface
1418
{
1519
/**
@@ -43,23 +47,29 @@ public function __construct(
4347
}
4448

4549
/**
46-
* {@inheritdoc}
50+
* @inheritdoc
4751
*/
4852
public function save(\Magento\Eav\Api\Data\AttributeGroupInterface $group)
4953
{
54+
/** @var \Magento\Catalog\Model\Product\Attribute\Group $group */
55+
$extensionAttributes = $group->getExtensionAttributes();
56+
if ($extensionAttributes) {
57+
$group->setSortOrder($extensionAttributes->getSortOrder());
58+
$group->setAttributeGroupCode($extensionAttributes->getAttributeGroupCode());
59+
}
5060
return $this->groupRepository->save($group);
5161
}
5262

5363
/**
54-
* {@inheritdoc}
64+
* @inheritdoc
5565
*/
5666
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
5767
{
5868
return $this->groupRepository->getList($searchCriteria);
5969
}
6070

6171
/**
62-
* {@inheritdoc}
72+
* @inheritdoc
6373
*/
6474
public function get($groupId)
6575
{
@@ -75,7 +85,7 @@ public function get($groupId)
7585
}
7686

7787
/**
78-
* {@inheritdoc}
88+
* @inheritdoc
7989
*/
8090
public function deleteById($groupId)
8191
{
@@ -86,7 +96,7 @@ public function deleteById($groupId)
8696
}
8797

8898
/**
89-
* {@inheritdoc}
99+
* @inheritdoc
90100
*/
91101
public function delete(\Magento\Eav\Api\Data\AttributeGroupInterface $group)
92102
{

app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ switch ($type = $block->getType()) {
170170
<?php if ($type == 'related' && $canItemsAddToCart) :?>
171171
<div class="block-actions">
172172
<?= $block->escapeHtml(__('Check items to add to the cart or')) ?>
173-
<button type="button" class="action select" role="button"><span><?= $block->escapeHtml(__('select all')) ?></span></button>
173+
<button type="button" class="action select" data-role="select-all"><span><?= $block->escapeHtml(__('select all')) ?></span></button>
174174
</div>
175175
<?php endif; ?>
176176
<div class="products wrapper grid products-grid products-<?= $block->escapeHtmlAttr($type) ?>">

app/code/Magento/Catalog/view/frontend/web/js/related-products.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define([
1717
relatedProductsField: '#related-products-field', // Hidden input field that stores related products.
1818
selectAllMessage: $.mage.__('select all'),
1919
unselectAllMessage: $.mage.__('unselect all'),
20-
selectAllLink: '[role="button"]',
20+
selectAllLink: '[data-role="select-all"]',
2121
elementsSelector: '.item.product'
2222
},
2323

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+
declare(strict_types=1);
7+
8+
namespace Magento\Customer\Observer;
9+
10+
use Magento\Framework\Event\ObserverInterface;
11+
use Magento\Framework\Event\Observer;
12+
use Magento\Framework\Exception\NoSuchEntityException;
13+
use Magento\Quote\Api\CartRepositoryInterface;
14+
15+
/**
16+
* Class observer UpgradeQuoteCustomerEmailObserver
17+
*/
18+
class UpgradeQuoteCustomerEmailObserver implements ObserverInterface
19+
{
20+
/**
21+
* @var CartRepositoryInterface
22+
*/
23+
private $quoteRepository;
24+
25+
/**
26+
* @param CartRepositoryInterface $quoteRepository
27+
*/
28+
public function __construct(
29+
CartRepositoryInterface $quoteRepository
30+
) {
31+
$this->quoteRepository = $quoteRepository;
32+
}
33+
34+
/**
35+
* Upgrade quote customer email when customer has changed email
36+
*
37+
* @param Observer $observer
38+
* @return void
39+
*/
40+
public function execute(Observer $observer): void
41+
{
42+
/** @var \Magento\Customer\Model\Data\Customer $customerOrig */
43+
$customerOrig = $observer->getEvent()->getOrigCustomerDataObject();
44+
if (!$customerOrig) {
45+
return;
46+
}
47+
48+
$emailOrig = $customerOrig->getEmail();
49+
50+
/** @var \Magento\Customer\Model\Data\Customer $customer */
51+
$customer = $observer->getEvent()->getCustomerDataObject();
52+
$email = $customer->getEmail();
53+
54+
if ($email == $emailOrig) {
55+
return;
56+
}
57+
58+
try {
59+
$quote = $this->quoteRepository->getForCustomer($customer->getId());
60+
$quote->setCustomerEmail($email);
61+
$this->quoteRepository->save($quote);
62+
} catch (NoSuchEntityException $e) {
63+
return;
64+
}
65+
}
66+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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\Customer\Test\Unit\Observer;
9+
10+
use Magento\Customer\Observer\UpgradeQuoteCustomerEmailObserver;
11+
12+
/**
13+
* Class UpgradeQuoteCustomerEmailObserverTest for testing upgrade quote customer email
14+
*/
15+
class UpgradeQuoteCustomerEmailObserverTest extends \PHPUnit\Framework\TestCase
16+
{
17+
/**
18+
* @var UpgradeQuoteCustomerEmailObserver
19+
*/
20+
protected $model;
21+
22+
/**
23+
* @var \Magento\Quote\Api\CartRepositoryInterface
24+
*/
25+
protected $quoteRepositoryMock;
26+
27+
/**
28+
* @var \Magento\Framework\Event\Observer
29+
*/
30+
protected $observerMock;
31+
32+
/**
33+
* @var \Magento\Framework\Event
34+
*/
35+
protected $eventMock;
36+
37+
/**
38+
* @inheritdoc
39+
*/
40+
protected function setUp()
41+
{
42+
$this->observerMock = $this->getMockBuilder(\Magento\Framework\Event\Observer::class)
43+
->disableOriginalConstructor()
44+
->getMock();
45+
46+
$this->eventMock = $this->getMockBuilder(\Magento\Framework\Event::class)
47+
->disableOriginalConstructor()
48+
->setMethods(['getCustomerDataObject', 'getOrigCustomerDataObject'])
49+
->getMock();
50+
51+
$this->observerMock->expects($this->any())->method('getEvent')->will($this->returnValue($this->eventMock));
52+
53+
$this->quoteRepositoryMock = $this
54+
->getMockBuilder(\Magento\Quote\Api\CartRepositoryInterface::class)
55+
->getMockForAbstractClass();
56+
$this->model = new UpgradeQuoteCustomerEmailObserver($this->quoteRepositoryMock);
57+
}
58+
59+
/**
60+
* Unit test for verifying quote customers email upgrade observer
61+
*/
62+
public function testUpgradeQuoteCustomerEmail()
63+
{
64+
$email = "test@test.com";
65+
$origEmail = "origtest@test.com";
66+
67+
$customer = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
68+
->disableOriginalConstructor()
69+
->getMock();
70+
$customerOrig = $this->getMockBuilder(\Magento\Customer\Api\Data\CustomerInterface::class)
71+
->disableOriginalConstructor()
72+
->getMock();
73+
74+
$quoteMock = $this->getMockBuilder(\Magento\Quote\Model\Quote::class)
75+
->setMethods(['setCustomerEmail'])
76+
->disableOriginalConstructor()
77+
->getMock();
78+
79+
$this->eventMock->expects($this->any())
80+
->method('getCustomerDataObject')
81+
->will($this->returnValue($customer));
82+
$this->eventMock->expects($this->any())
83+
->method('getOrigCustomerDataObject')
84+
->will($this->returnValue($customerOrig));
85+
86+
$customerOrig->expects($this->any())
87+
->method('getEmail')
88+
->willReturn($this->returnValue($origEmail));
89+
90+
$customer->expects($this->any())
91+
->method('getEmail')
92+
->willReturn($this->returnValue($email));
93+
94+
$this->quoteRepositoryMock->expects($this->once())
95+
->method('getForCustomer')
96+
->willReturn($quoteMock);
97+
98+
$quoteMock->expects($this->once())
99+
->method('setCustomerEmail');
100+
101+
$this->quoteRepositoryMock->expects($this->once())
102+
->method('save')
103+
->with($quoteMock);
104+
105+
$this->model->execute($this->observerMock);
106+
}
107+
}

app/code/Magento/Customer/etc/events.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@
1515
<event name="sales_quote_save_after">
1616
<observer name="customer_visitor" instance="Magento\Customer\Observer\Visitor\BindQuoteCreateObserver" />
1717
</event>
18+
<event name="customer_save_after_data_object">
19+
<observer name="upgrade_quote_customer_email" instance="Magento\Customer\Observer\UpgradeQuoteCustomerEmailObserver"/>
20+
</event>
1821
</config>

app/code/Magento/Review/Block/Adminhtml/Grid.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Review\Block\Adminhtml;
89

@@ -15,8 +16,6 @@
1516
* @method \Magento\Review\Block\Adminhtml\Grid setCustomerId() setCustomerId(int $customerId)
1617
* @method \Magento\Review\Block\Adminhtml\Grid setMassactionIdFieldOnlyIndexValue()
1718
* setMassactionIdFieldOnlyIndexValue(bool $onlyIndex)
18-
*
19-
* @author Magento Core Team <core@magentocommerce.com>
2019
*/
2120
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
2221
{
@@ -239,7 +238,13 @@ protected function _prepareColumns()
239238
if (!$this->_storeManager->isSingleStoreMode()) {
240239
$this->addColumn(
241240
'visible_in',
242-
['header' => __('Visibility'), 'index' => 'stores', 'type' => 'store', 'store_view' => true]
241+
[
242+
'header' => __('Visibility'),
243+
'index' => 'stores',
244+
'type' => 'store',
245+
'store_view' => true,
246+
'sortable' => false
247+
]
243248
);
244249
}
245250

0 commit comments

Comments
 (0)