Skip to content

Commit 4c550d0

Browse files
author
Mariana Lashch
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into port-96379
2 parents 6b7755c + 807ee7d commit 4c550d0

23 files changed

+285
-29
lines changed

app/code/Magento/Bundle/Model/Product/SaveHandler.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public function __construct(
5858
}
5959

6060
/**
61+
* Perform action on Bundle product relation/extension attribute
62+
*
6163
* @param object $entity
6264
* @param array $arguments
6365
*
@@ -83,7 +85,7 @@ public function execute($entity, $arguments = [])
8385
: [];
8486

8587
if (!$entity->getCopyFromView()) {
86-
$this->processRemovedOptions($entity->getSku(), $existingOptionsIds, $optionIds);
88+
$this->processRemovedOptions($entity, $existingOptionsIds, $optionIds);
8789
$newOptionsIds = array_diff($optionIds, $existingOptionsIds);
8890
$this->saveOptions($entity, $bundleProductOptions, $newOptionsIds);
8991
} else {
@@ -96,6 +98,8 @@ public function execute($entity, $arguments = [])
9698
}
9799

98100
/**
101+
* Remove option product links
102+
*
99103
* @param string $entitySku
100104
* @param \Magento\Bundle\Api\Data\OptionInterface $option
101105
* @return void
@@ -154,16 +158,19 @@ private function getOptionIds(array $options): array
154158
/**
155159
* Removes old options that no longer exists.
156160
*
157-
* @param string $entitySku
161+
* @param ProductInterface $entity
158162
* @param array $existingOptionsIds
159163
* @param array $optionIds
160164
* @return void
161165
*/
162-
private function processRemovedOptions(string $entitySku, array $existingOptionsIds, array $optionIds): void
166+
private function processRemovedOptions(ProductInterface $entity, array $existingOptionsIds, array $optionIds): void
163167
{
168+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
169+
$parentId = $entity->getData($metadata->getLinkField());
164170
foreach (array_diff($existingOptionsIds, $optionIds) as $optionId) {
165-
$option = $this->optionRepository->get($entitySku, $optionId);
166-
$this->removeOptionLinks($entitySku, $option);
171+
$option = $this->optionRepository->get($entity->getSku(), $optionId);
172+
$option->setParentId($parentId);
173+
$this->removeOptionLinks($entity->getSku(), $option);
167174
$this->optionRepository->delete($option);
168175
}
169176
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-61717"/>
1919
<group value="Catalog"/>
20+
<!-- skip due to MAGETWO-97424 -->
21+
<group value="skip"/>
2022
</annotations>
2123
<before>
2224
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>

app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ define([
291291
images = this.options.spConfig.images[this.simpleProduct];
292292

293293
if (images) {
294+
images = this._sortImages(images);
295+
294296
if (this.options.gallerySwitchStrategy === 'prepend') {
295297
images = images.concat(initialImages);
296298
}
@@ -309,7 +311,17 @@ define([
309311
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents();
310312
}
311313

312-
galleryObject.first();
314+
},
315+
316+
/**
317+
* Sorting images array
318+
*
319+
* @private
320+
*/
321+
_sortImages: function (images) {
322+
return _.sortBy(images, function (image) {
323+
return image.position;
324+
});
313325
},
314326

315327
/**

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,12 @@ protected function _updateCustomerSubscription($customerId, $subscribe)
591591
if (AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED
592592
== $this->customerAccountManagement->getConfirmationStatus($customerId)
593593
) {
594-
$status = self::STATUS_UNCONFIRMED;
594+
if ($this->getId() && $this->getStatus() == self::STATUS_SUBSCRIBED) {
595+
// if a customer was already subscribed then keep the subscribed
596+
$status = self::STATUS_SUBSCRIBED;
597+
} else {
598+
$status = self::STATUS_UNCONFIRMED;
599+
}
595600
} elseif ($isConfirmNeed) {
596601
if ($this->getStatus() != self::STATUS_SUBSCRIBED) {
597602
$status = self::STATUS_NOT_ACTIVE;

app/code/Magento/Persistent/Model/Checkout/GuestPaymentInformationManagementPlugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public function beforeSavePaymentInformationAndPlaceOrder(
108108
$this->customerSession->setCustomerId(null);
109109
$this->customerSession->setCustomerGroupId(null);
110110
$this->quoteManager->convertCustomerCartToGuest();
111-
/** @var \Magento\Quote\Api\Data\CartInterface $quote */
112-
$quote = $this->cartRepository->get($this->checkoutSession->getQuote()->getId());
111+
$quoteId = $this->checkoutSession->getQuoteId();
112+
$quote = $this->cartRepository->get($quoteId);
113113
$quote->setCustomerEmail($email);
114114
$quote->getAddressesCollection()->walk('setEmail', ['email' => $email]);
115115
$this->cartRepository->save($quote);

app/code/Magento/Persistent/Model/QuoteManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ public function setGuest($checkQuote = false)
108108
*/
109109
public function convertCustomerCartToGuest()
110110
{
111+
$quoteId = $this->checkoutSession->getQuoteId();
111112
/** @var $quote \Magento\Quote\Model\Quote */
112-
$quote = $this->quoteRepository->get($this->checkoutSession->getQuoteId());
113+
$quote = $this->quoteRepository->get($quoteId);
113114
if ($quote && $quote->getId()) {
114115
$this->_setQuotePersistent = false;
115116
$quote->setIsActive(true)

app/code/Magento/Persistent/Test/Unit/Model/Checkout/GuestPaymentInformationManagementPluginTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderCartConvertsToGuest
102102
['setCustomerEmail', 'getAddressesCollection'],
103103
false
104104
);
105-
$this->checkoutSessionMock->expects($this->once())->method('getQuote')->willReturn($quoteMock);
106-
$quoteMock->expects($this->once())->method('getId')->willReturn($cartId);
105+
$this->checkoutSessionMock->method('getQuoteId')->willReturn($cartId);
107106
$this->cartRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($quoteMock);
108107
$quoteMock->expects($this->once())->method('setCustomerEmail')->with($email);
109108
/** @var \Magento\Framework\Data\Collection|\PHPUnit_Framework_MockObject_MockObject $collectionMock */
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
<!--Fill order information fields and click continue-->
12+
<actionGroup name="StorefrontFillOrderInformationActionGroup">
13+
<arguments>
14+
<argument name="orderId" type="string"/>
15+
<argument name="orderLastName"/>
16+
<argument name="orderEmail"/>
17+
</arguments>
18+
<amOnPage url="{{StorefrontOrdersAndReturnsPage.url}}" stepKey="navigateToOrderAndReturnPage"/>
19+
<waitForPageLoad stepKey="waitForPageLoad"/>
20+
<fillField selector="{{StorefrontOrderAndReturnInformationSection.orderId}}" userInput="{{orderId}}" stepKey="fillOrderId"/>
21+
<fillField selector="{{StorefrontOrderAndReturnInformationSection.bilingLastName}}" userInput="{{orderLastName}}" stepKey="fillBillingLastName"/>
22+
<fillField selector="{{StorefrontOrderAndReturnInformationSection.email}}" userInput="{{orderEmail}}" stepKey="fillEmail"/>
23+
<click selector="{{StorefrontOrderAndReturnInformationSection.continueButton}}" stepKey="clickContinue"/>
24+
<waitForPageLoad stepKey="waitForOrderInformationPageLoad"/>
25+
<seeInCurrentUrl url="{{StorefrontOrderInformationPage.url}}" stepKey="seeOrderInformationUrl"/>
26+
</actionGroup>
27+
28+
<!--Enter quantity to return and submit-->
29+
<actionGroup name="StorefrontFillQuantityToReturnActionGroup">
30+
<click selector="{{StorefrontOrderInformationMainSection.return}}" stepKey="gotToCreateNewReturnPage"/>
31+
<waitForPageLoad stepKey="waitForReturnPageLoad"/>
32+
<fillField selector="{{StorefrontCreateNewReturnMainSection.quantityToReturn}}" userInput="1" stepKey="fillQuantityToReturn"/>
33+
<click selector="{{StorefrontCreateNewReturnMainSection.submit}}" stepKey="clickSubmit"/>
34+
<waitForPageLoad stepKey="waitForPageLoad"/>
35+
</actionGroup>
36+
</actionGroups>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="EnableRMA" type="sales_rma_config">
11+
<requiredEntity type="enabled">EnableRMAStorefront</requiredEntity>
12+
</entity>
13+
<entity name="EnableRMAStorefront" type="enabled">
14+
<data key="value">1</data>
15+
</entity>
16+
17+
<entity name="DisableRMA" type="sales_rma_config">
18+
<requiredEntity type="enabled">DisableRMAStorefront</requiredEntity>
19+
</entity>
20+
<entity name="DisableRMAStorefront" type="enabled">
21+
<data key="value">0</data>
22+
</entity>
23+
</entities>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
9+
<operation name="SalesRMAConfig" dataType="sales_rma_config" type="create" auth="adminFormKey" url="/admin/system_config/save/section/sales/" method="POST">
10+
<object key="groups" dataType="sales_rma_config">
11+
<object key="rma" dataType="sales_rma_config">
12+
<object key="fields" dataType="sales_rma_config">
13+
<object key="enabled" dataType="enabled">
14+
<field key="value">string</field>
15+
</object>
16+
</object>
17+
</object>
18+
</object>
19+
</operation>
20+
</operations>

0 commit comments

Comments
 (0)