Skip to content

Commit 3121973

Browse files
committed
Merge remote-tracking branch 'mainline/2.2-develop' into MAGETWO-94670
2 parents 0a3352c + 448770c commit 3121973

File tree

354 files changed

+5681
-7221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+5681
-7221
lines changed

app/code/Magento/AdminNotification/Test/Mftf/composer.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/code/Magento/AdvancedPricingImportExport/Test/Mftf/composer.json

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/code/Magento/Analytics/Test/Mftf/composer.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

app/code/Magento/Authorization/Test/Mftf/composer.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/code/Magento/Authorizenet/Test/Mftf/composer.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/Backend/Block/Widget/Button/ButtonList.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,6 @@ public function getItems()
127127
*/
128128
public function sortButtons(Item $itemA, Item $itemB)
129129
{
130-
$sortOrderA = (int)$itemA->getSortOrder();
131-
$sortOrderB = (int)$itemB->getSortOrder();
132-
133-
if ($sortOrderA == $sortOrderB) {
134-
return 0;
135-
}
136-
return ($sortOrderA < $sortOrderB) ? -1 : 1;
130+
return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder();
137131
}
138132
}

app/code/Magento/Backend/Test/Mftf/composer.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

app/code/Magento/Backup/Test/Mftf/composer.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/code/Magento/Braintree/Test/Mftf/composer.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Bundle\Model\Option;
99
use Magento\Catalog\Model\Product;
10+
use Magento\Framework\DataObject;
1011

1112
/**
1213
* Catalog bundle product info block
@@ -166,7 +167,7 @@ public function getJsonConfig()
166167

167168
$defaultValues = [];
168169
$preConfiguredFlag = $currentProduct->hasPreconfiguredValues();
169-
/** @var \Magento\Framework\DataObject|null $preConfiguredValues */
170+
/** @var DataObject|null $preConfiguredValues */
170171
$preConfiguredValues = $preConfiguredFlag ? $currentProduct->getPreconfiguredValues() : null;
171172

172173
$position = 0;
@@ -185,12 +186,13 @@ public function getJsonConfig()
185186
if ($configValue) {
186187
$defaultValues[$optionId] = $configValue;
187188
}
189+
$options = $this->processOptions($optionId, $options, $preConfiguredValues);
188190
}
189191
$position++;
190192
}
191193
$config = $this->getConfigData($currentProduct, $options);
192194

193-
$configObj = new \Magento\Framework\DataObject(
195+
$configObj = new DataObject(
194196
[
195197
'config' => $config,
196198
]
@@ -393,4 +395,30 @@ private function getConfigData(Product $product, array $options)
393395
];
394396
return $config;
395397
}
398+
399+
/**
400+
* Set preconfigured quantities and selections to options.
401+
*
402+
* @param string $optionId
403+
* @param array $options
404+
* @param DataObject $preConfiguredValues
405+
* @return array
406+
*/
407+
private function processOptions(string $optionId, array $options, DataObject $preConfiguredValues)
408+
{
409+
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
410+
$selections = $options[$optionId]['selections'];
411+
array_walk($selections, function (&$selection, $selectionId) use ($preConfiguredQtys) {
412+
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
413+
$selection['qty'] = $preConfiguredQtys[$selectionId];
414+
} else {
415+
if ((int)$preConfiguredQtys > 0) {
416+
$selection['qty'] = $preConfiguredQtys;
417+
}
418+
}
419+
});
420+
$options[$optionId]['selections'] = $selections;
421+
422+
return $options;
423+
}
396424
}

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle/Option.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ protected function _getSelectedOptions()
169169
*/
170170
protected function assignSelection(\Magento\Bundle\Model\Option $option, $selectionId)
171171
{
172-
if ($selectionId && $option->getSelectionById($selectionId)) {
172+
if (is_array($selectionId)) {
173+
$this->_selectedOptions = $selectionId;
174+
} else if ($selectionId && $option->getSelectionById($selectionId)) {
173175
$this->_selectedOptions = $selectionId;
174176
} elseif (!$option->getRequired()) {
175177
$this->_selectedOptions = 'None';

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,10 +1013,8 @@ public function shakeSelections($firstItem, $secondItem)
10131013
$secondItem->getPosition(),
10141014
$secondItem->getSelectionId(),
10151015
];
1016-
if ($aPosition == $bPosition) {
1017-
return 0;
1018-
}
1019-
return $aPosition < $bPosition ? -1 : 1;
1016+
1017+
return $aPosition <=> $bPosition;
10201018
}
10211019

10221020
/**

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ protected function _construct()
151151
*/
152152
public function _afterLoad()
153153
{
154-
parent::_afterLoad();
155-
if ($this->getStoreId() && $this->_items) {
156-
foreach ($this->_items as $item) {
157-
$item->setStoreId($this->getStoreId());
158-
}
159-
}
160-
return $this;
154+
return parent::_afterLoad();
161155
}
162156

163157
/**
@@ -356,7 +350,10 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
356350
}
357351

358352
/**
353+
* Get Catalog Rule Processor.
354+
*
359355
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
356+
*
360357
* @deprecated 100.2.0
361358
*/
362359
private function getCatalogRuleProcessor()

app/code/Magento/Bundle/Test/Mftf/Data/BundleLinkData.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="ApiBundleLink" type="bundle_link">
12-
<var key="sku" entityKey="sku" entityType="product2"/>
1312
<var key="option_id" entityKey="return" entityType="bundle_option"/>
1413
<var key="sku" entityKey="sku" entityType="product"/>
1514
<data key="qty">1</data>

app/code/Magento/Bundle/Test/Mftf/Data/BundleProductData.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<data key="urlKey" unique="suffix">bundleproduct</data>
2121
<data key="visibility">4</data>
2222
<data key="option_title" unique="suffix">TestOption</data>
23-
<data key="input_type" >Drop-down</data>
2423
<data key="default_quantity1" >10</data>
2524
<data key="default_quantity2" >20</data>
2625
<data key="input_type" >Drop-down</data>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@
9696
<click selector="{{CheckoutCartProductSection.editItemParametersButton('1')}}" stepKey="clickEdit"/>
9797
<waitForPageLoad stepKey="waitForStorefront2"/>
9898

99-
<!-- Choose both of the options on the storefront -->
100-
<click selector="{{StorefrontBundledSection.bundleOption('1','1')}}" stepKey="selectFirstBundleOption2"/>
99+
<!-- Check second one option to choose both of the options on the storefront -->
101100
<click selector="{{StorefrontBundledSection.bundleOption('1','2')}}" stepKey="selectSecondBundleOption2"/>
102101

103102
<waitForPageLoad stepKey="waitForPriceUpdate3"/>

app/code/Magento/Bundle/Test/Mftf/composer.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)