Skip to content

Commit 44d2dba

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into MC-29522
2 parents 0174953 + 3009388 commit 44d2dba

File tree

10 files changed

+390
-30
lines changed

10 files changed

+390
-30
lines changed

app/code/Magento/Catalog/view/frontend/web/template/product/image_with_borders.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
-->
77
<span class="product-image-container" data-bind="style: {width: width + 'px'}">
88
<span class="product-image-wrapper" data-bind="style: {'padding-bottom': height/width*100 + '%'}">
9-
<img class="product-image-photo" data-bind="attr: {src: src, alt: alt}, style: {width: width + 'px', height: height + 'px'}" />
9+
<img class="product-image-photo" data-bind="attr: {src: src, alt: alt}, style: {width: 'auto', height: 'auto'}" />
1010
</span>
1111
</span>

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,6 @@
5757
<aspect name="update" />
5858
</field>
5959
</fieldset>
60-
<fieldset id="customer_address">
61-
<field name="vat_id">
62-
<aspect name="to_quote_address" />
63-
</field>
64-
<field name="vat_is_valid">
65-
<aspect name="to_quote_address" />
66-
</field>
67-
<field name="vat_request_id">
68-
<aspect name="to_quote_address" />
69-
</field>
70-
<field name="vat_request_date">
71-
<aspect name="to_quote_address" />
72-
</field>
73-
<field name="vat_request_success">
74-
<aspect name="to_quote_address" />
75-
</field>
76-
</fieldset>
7760
<fieldset id="sales_convert_order_address">
7861
<field name="vat_id">
7962
<aspect name="to_quote_address" />

app/code/Magento/Quote/Model/ShippingMethodManagement.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Quote\Model;
88

99
use Magento\Customer\Api\Data\AddressInterfaceFactory;
10+
use Magento\Customer\Model\Session as CustomerSession;
1011
use Magento\Framework\App\ObjectManager;
1112
use Magento\Framework\Exception\CouldNotSaveException;
1213
use Magento\Framework\Exception\InputException;
@@ -22,6 +23,7 @@
2223
* Shipping method read service
2324
*
2425
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
26+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2527
*/
2628
class ShippingMethodManagement implements
2729
\Magento\Quote\Api\ShippingMethodManagementInterface,
@@ -69,6 +71,11 @@ class ShippingMethodManagement implements
6971
*/
7072
private $quoteAddressResource;
7173

74+
/**
75+
* @var CustomerSession
76+
*/
77+
private $customerSession;
78+
7279
/**
7380
* Constructor
7481
*
@@ -78,14 +85,16 @@ class ShippingMethodManagement implements
7885
* @param Quote\TotalsCollector $totalsCollector
7986
* @param AddressInterfaceFactory|null $addressFactory
8087
* @param QuoteAddressResource|null $quoteAddressResource
88+
* @param CustomerSession|null $customerSession
8189
*/
8290
public function __construct(
8391
\Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
8492
Cart\ShippingMethodConverter $converter,
8593
\Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
8694
\Magento\Quote\Model\Quote\TotalsCollector $totalsCollector,
8795
AddressInterfaceFactory $addressFactory = null,
88-
QuoteAddressResource $quoteAddressResource = null
96+
QuoteAddressResource $quoteAddressResource = null,
97+
CustomerSession $customerSession = null
8998
) {
9099
$this->quoteRepository = $quoteRepository;
91100
$this->converter = $converter;
@@ -95,10 +104,11 @@ public function __construct(
95104
->get(AddressInterfaceFactory::class);
96105
$this->quoteAddressResource = $quoteAddressResource ?: ObjectManager::getInstance()
97106
->get(QuoteAddressResource::class);
107+
$this->customerSession = $customerSession ?? ObjectManager::getInstance()->get(CustomerSession::class);
98108
}
99109

100110
/**
101-
* {@inheritDoc}
111+
* @inheritDoc
102112
*/
103113
public function get($cartId)
104114
{
@@ -126,7 +136,7 @@ public function get($cartId)
126136
}
127137

128138
/**
129-
* {@inheritDoc}
139+
* @inheritDoc
130140
*/
131141
public function getList($cartId)
132142
{
@@ -155,7 +165,7 @@ public function getList($cartId)
155165
}
156166

157167
/**
158-
* {@inheritDoc}
168+
* @inheritDoc
159169
*/
160170
public function set($cartId, $carrierCode, $methodCode)
161171
{
@@ -176,6 +186,8 @@ public function set($cartId, $carrierCode, $methodCode)
176186
}
177187

178188
/**
189+
* Apply carrier code.
190+
*
179191
* @param int $cartId The shopping cart ID.
180192
* @param string $carrierCode The carrier code.
181193
* @param string $methodCode The shipping method code.
@@ -209,7 +221,7 @@ public function apply($cartId, $carrierCode, $methodCode)
209221
}
210222

211223
/**
212-
* {@inheritDoc}
224+
* @inheritDoc
213225
*/
214226
public function estimateByAddress($cartId, \Magento\Quote\Api\Data\EstimateAddressInterface $address)
215227
{
@@ -240,7 +252,7 @@ public function estimateByExtendedAddress($cartId, AddressInterface $address)
240252
}
241253

242254
/**
243-
* {@inheritDoc}
255+
* @inheritDoc
244256
*/
245257
public function estimateByAddressId($cartId, $addressId)
246258
{
@@ -266,6 +278,7 @@ public function estimateByAddressId($cartId, $addressId)
266278
* @param string $region
267279
* @param \Magento\Framework\Api\ExtensibleDataInterface|null $address
268280
* @return \Magento\Quote\Api\Data\ShippingMethodInterface[] An array of shipping methods.
281+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
269282
* @deprecated 100.2.0
270283
*/
271284
protected function getEstimatedRates(
@@ -277,11 +290,10 @@ protected function getEstimatedRates(
277290
$address = null
278291
) {
279292
if (!$address) {
280-
$address = $this->getAddressFactory()->create()
293+
$address = $this->addressFactory->create()
281294
->setCountryId($country)
282295
->setPostcode($postcode)
283-
->setRegionId($regionId)
284-
->setRegion($region);
296+
->setRegionId($regionId);
285297
}
286298
return $this->getShippingMethods($quote, $address);
287299
}
@@ -301,12 +313,21 @@ private function getShippingMethods(Quote $quote, $address)
301313
$shippingAddress->setCollectShippingRates(true);
302314

303315
$this->totalsCollector->collectAddressTotals($quote, $shippingAddress);
316+
$quoteCustomerGroupId = $quote->getCustomerGroupId();
317+
$customerGroupId = $this->customerSession->getCustomerGroupId();
318+
$isCustomerGroupChanged = $quoteCustomerGroupId !== $customerGroupId;
319+
if ($isCustomerGroupChanged) {
320+
$quote->setCustomerGroupId($customerGroupId);
321+
}
304322
$shippingRates = $shippingAddress->getGroupedAllShippingRates();
305323
foreach ($shippingRates as $carrierRates) {
306324
foreach ($carrierRates as $rate) {
307325
$output[] = $this->converter->modelToDataObject($rate, $quote->getQuoteCurrencyCode());
308326
}
309327
}
328+
if ($isCustomerGroupChanged) {
329+
$quote->setCustomerGroupId($quoteCustomerGroupId);
330+
}
310331
return $output;
311332
}
312333

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!--Navigate to create order page (New Order -> Select Customer)-->
12+
<actionGroup name="NavigateToNewOrderPageExistingCustomerActionGroup">
13+
<arguments>
14+
<argument name="customer"/>
15+
<argument name="storeView" defaultValue="_defaultStore"/>
16+
</arguments>
17+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/>
18+
<waitForPageLoad stepKey="waitForIndexPageLoad"/>
19+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Orders" stepKey="seeIndexPageTitle"/>
20+
<click selector="{{AdminOrdersGridSection.createNewOrder}}" stepKey="clickCreateNewOrder"/>
21+
<waitForPageLoad stepKey="waitForCustomerGridLoad"/>
22+
23+
<conditionalClick selector="{{AdminOrderCustomersGridSection.resetButton}}" dependentSelector="{{AdminOrderCustomersGridSection.resetButton}}" visible="true" stepKey="clearExistingCustomerFilters"/>
24+
<fillField userInput="{{customer.email}}" selector="{{AdminOrderCustomersGridSection.emailInput}}" stepKey="filterEmail"/>
25+
<click selector="{{AdminOrderCustomersGridSection.apply}}" stepKey="applyFilter"/>
26+
<waitForPageLoad stepKey="waitForFilteredCustomerGridLoad"/>
27+
<click selector="{{AdminOrderCustomersGridSection.firstRow}}" stepKey="clickOnCustomer"/>
28+
<waitForPageLoad stepKey="waitForCreateOrderPageLoad"/>
29+
30+
<conditionalClick selector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" dependentSelector="{{AdminOrderStoreScopeTreeSection.storeOption(storeView.name)}}" visible="true" stepKey="selectStoreViewIfAppears"/>
31+
<waitForPageLoad stepKey="waitForCreateOrderPageLoadAfterStoreSelect"/>
32+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="Create New Order" stepKey="seeNewOrderPageTitle"/>
33+
</actionGroup>
34+
</actionGroups>

app/code/Magento/Wishlist/Controller/Index/Plugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Framework\App\Config\ScopeConfigInterface;
1111
use Magento\Framework\App\RequestInterface;
1212
use Magento\Framework\App\Response\RedirectInterface;
13+
use Magento\Store\Model\ScopeInterface;
1314

1415
/**
1516
* Wishlist plugin before dispatch
@@ -89,7 +90,7 @@ public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject,
8990
$this->messageManager->addErrorMessage(__('You must login or register to add items to your wishlist.'));
9091
}
9192
}
92-
if (!$this->config->isSetFlag('wishlist/general/active')) {
93+
if (!$this->config->isSetFlag('wishlist/general/active', ScopeInterface::SCOPE_STORES)) {
9394
throw new NotFoundException(__('Page not found.'));
9495
}
9596
}

app/code/Magento/Wishlist/Test/Unit/Controller/Index/PluginTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
namespace Magento\Wishlist\Test\Unit\Controller\Index;
88

9+
use Magento\Store\Model\ScopeInterface;
10+
911
/**
1012
* Test for wishlist plugin before dispatch
13+
*
14+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1115
*/
1216
class PluginTest extends \PHPUnit\Framework\TestCase
1317
{
@@ -175,7 +179,7 @@ public function testBeforeDispatch()
175179
$this->config
176180
->expects($this->once())
177181
->method('isSetFlag')
178-
->with('wishlist/general/active')
182+
->with('wishlist/general/active', ScopeInterface::SCOPE_STORES)
179183
->willReturn(false);
180184

181185
$this->getPlugin()->beforeDispatch($indexController, $this->request);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
use Magento\Framework\Api\SearchCriteriaBuilder;
9+
use Magento\Customer\Api\GroupRepositoryInterface;
10+
use Magento\TestFramework\Helper\Bootstrap;
11+
use Magento\Framework\ObjectManagerInterface;
12+
use Magento\Framework\Exception\NoSuchEntityException;
13+
use Magento\Customer\Api\Data\GroupInterface;
14+
15+
/** @var ObjectManagerInterface $objectManager */
16+
$objectManager = Bootstrap::getObjectManager();
17+
$groupRepository = $objectManager->get(GroupRepositoryInterface::class);
18+
/** @var SearchCriteriaBuilder $searchBuilder */
19+
$searchBuilder = $objectManager->get(SearchCriteriaBuilder::class);
20+
$searchCriteria = $searchBuilder->addFilter(GroupInterface::CODE, 'custom_group')
21+
->create();
22+
$groups = $groupRepository->getList($searchCriteria)
23+
->getItems();
24+
foreach ($groups as $group) {
25+
try {
26+
$groupRepository->delete($group);
27+
} catch (NoSuchEntityException $exception) {
28+
//Group already removed
29+
}
30+
}

0 commit comments

Comments
 (0)