Skip to content

Commit d329ac7

Browse files
Merge branch '2.4-develop' into 2.4-develop-prs
2 parents 37c34a3 + ef0ffcd commit d329ac7

File tree

49 files changed

+1922
-123
lines changed

Some content is hidden

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

49 files changed

+1922
-123
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroup name="AdminOpenAndApplyBundleItemsOptionPerPageActionGroup">
12+
<annotations>
13+
<description>Open the bundle item options drop down section and assign the user defined custom value</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="perPageInputValue" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<click selector="{{AdminProductGridPaginationSection.perPageDropdown}}" stepKey="clickProductPerPageDropdown"/>
20+
<click selector="{{AdminProductGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/>
21+
<fillField selector="{{AdminProductGridPaginationSection.perPageInput}}" userInput="{{perPageInputValue}}" stepKey="fillCustomPerPage"/>
22+
<click selector="{{AdminProductGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/>
23+
<waitForPageLoad stepKey="waitForPageRefreshCustomPerPage"/>
24+
</actionGroup>
25+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/AdminProductFormBundleSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,6 @@
111111
<element name="selectCategory" type="multiselect" selector="//div[@class='action-menu _active']//label[@class='admin__action-multiselect-label']" timeout="30"/>
112112
<element name="categoriesLabel" type="text" selector="//div[@class='action-menu _active']//button[@data-action='close-advanced-select']"/>
113113
<element name="userDefinedQuantity" type="checkbox" selector="[name='bundle_options[bundle_options][{{option}}][bundle_selections][{{product}}][selection_can_change_qty]'][type='checkbox']" parameterized="true"/>
114+
<element name="bundleItemsOptionTableRows" type="button" selector=".admin__dynamic-rows[data-index='bundle_selections'] tr.data-row" timeout="30"/>
114115
</section>
115116
</sections>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminValidateBundleProductWithBundleItemsOptionPerPageTest">
11+
<annotations>
12+
<features value="Catalog"/>
13+
<stories value="Bundle Product Backend : Sort Order does not work of Bundle Items in an Option"/>
14+
<title value="Admin to validate bundle product with the bundle items option dynamic rows per page"/>
15+
<description value="Admin to validate bundle product with the bundle items option dynamic rows per page"/>
16+
<severity value="AVERAGE"/>
17+
<testCaseId value="AC-2718"/>
18+
<useCaseId value="ACP2E-113"/>
19+
<group value="BundleProduct"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="login"/>
23+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
24+
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
25+
<magentoCron stepKey="runCronIndex" groups="index"/>
26+
</before>
27+
<after>
28+
<!--Delete custom added per page-->
29+
<actionGroup ref="AdminDataGridDeleteCustomPerPageActionGroup" stepKey="deleteCustomAddedPerPage">
30+
<argument name="perPage" value="ProductPerPage.productCount"/>
31+
</actionGroup>
32+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
33+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
34+
<!--Logout to Admin Area-->
35+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
36+
</after>
37+
38+
<!-- Open bundle product creation page. -->
39+
<actionGroup ref="AdminOpenCreateBundleProductPageActionGroup" stepKey="goToBundleProductCreationPage"/>
40+
<!-- Fill out main field for the bundle product -->
41+
<actionGroup ref="FillMainBundleProductFormActionGroup" stepKey="fillMainFieldsForBundle"/>
42+
<!-- Add Bundle items option with two simple product -->
43+
<actionGroup ref="AddBundleOptionWithTwoProductsActionGroup" stepKey="addBundleOptionWithTwoProducts2">
44+
<argument name="x" value="0"/>
45+
<argument name="n" value="1"/>
46+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
47+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
48+
<argument name="optionTitle" value="Option"/>
49+
<argument name="inputType" value="select"/>
50+
</actionGroup>
51+
<!-- Validate bundle items option dynamic rows per page -->
52+
<actionGroup ref="AdminOpenAndApplyBundleItemsOptionPerPageActionGroup" stepKey="openAndApplyPerPageDropdown">
53+
<argument name="perPageInputValue" value="1"/>
54+
</actionGroup>
55+
<waitForElementVisible selector="{{AdminProductFormBundleSection.bundleItemsOptionTableRows}}" stepKey="waitForRowsToBeVisible"/>
56+
<seeNumberOfElements selector="{{AdminProductFormBundleSection.bundleItemsOptionTableRows}}" userInput="1" stepKey="see4RowsOfOptions"/>
57+
</test>
58+
</tests>

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
*/
2727
class BundlePanel extends AbstractModifier
2828
{
29-
const GROUP_CONTENT = 'content';
30-
const CODE_SHIPMENT_TYPE = 'shipment_type';
31-
const CODE_BUNDLE_DATA = 'bundle-items';
32-
const CODE_AFFECT_BUNDLE_PRODUCT_SELECTIONS = 'affect_bundle_product_selections';
33-
const CODE_BUNDLE_HEADER = 'bundle_header';
34-
const CODE_BUNDLE_OPTIONS = 'bundle_options';
35-
const SORT_ORDER = 20;
29+
public const GROUP_CONTENT = 'content';
30+
public const CODE_SHIPMENT_TYPE = 'shipment_type';
31+
public const CODE_BUNDLE_DATA = 'bundle-items';
32+
public const CODE_AFFECT_BUNDLE_PRODUCT_SELECTIONS = 'affect_bundle_product_selections';
33+
public const CODE_BUNDLE_HEADER = 'bundle_header';
34+
public const CODE_BUNDLE_OPTIONS = 'bundle_options';
35+
public const SORT_ORDER = 20;
3636

3737
/**
3838
* @var UrlInterface
@@ -383,7 +383,10 @@ protected function getBundleOptions()
383383
'component' => 'Magento_Bundle/js/components/bundle-dynamic-rows-grid',
384384
'sortOrder' => 50,
385385
'additionalClasses' => 'admin__field-wide',
386-
'template' => 'ui/dynamic-rows/templates/default',
386+
'template' => 'Magento_Catalog/components/dynamic-rows-per-page',
387+
'sizesConfig' => [
388+
'enabled' => true
389+
],
387390
'provider' => 'product_form.product_form_data_source',
388391
'dataProvider' => '${ $.dataScope }' . '.bundle_button_proxy',
389392
'__disableTmpl' => ['dataProvider' => false],

app/code/Magento/Bundle/view/adminhtml/web/js/components/bundle-dynamic-rows-grid.js

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66
define([
77
'underscore',
8-
'Magento_Ui/js/dynamic-rows/dynamic-rows-grid'
9-
], function (_, dynamicRowsGrid) {
8+
'Magento_Ui/js/dynamic-rows/dynamic-rows-grid',
9+
'uiLayout',
10+
'rjsResolver'
11+
], function (_, dynamicRowsGrid, layout, resolver) {
1012
'use strict';
1113

1214
return dynamicRowsGrid.extend({
@@ -23,10 +25,74 @@ define([
2325
},
2426
listens: {
2527
inputType: 'onInputTypeChange',
26-
isDefaultValue: 'onIsDefaultValue'
28+
isDefaultValue: 'onIsDefaultValue',
29+
pageSize: 'onPageSizeChange'
30+
},
31+
sizesConfig: {
32+
component: 'Magento_Ui/js/grid/paging/sizes',
33+
name: '${ $.name }_sizes',
34+
options: {
35+
'20': {
36+
value: 20,
37+
label: 20
38+
},
39+
'30': {
40+
value: 30,
41+
label: 30
42+
},
43+
'50': {
44+
value: 50,
45+
label: 50
46+
},
47+
'100': {
48+
value: 100,
49+
label: 100
50+
},
51+
'200': {
52+
value: 200,
53+
label: 200
54+
}
55+
},
56+
storageConfig: {
57+
provider: '${ $.storageConfig.provider }',
58+
namespace: '${ $.storageConfig.namespace }'
59+
},
60+
enabled: false
61+
},
62+
links: {
63+
options: '${ $.sizesConfig.name }:options',
64+
pageSize: '${ $.sizesConfig.name }:value'
65+
},
66+
modules: {
67+
sizes: '${ $.sizesConfig.name }'
2768
}
2869
},
2970

71+
/**
72+
* Initializes paging component.
73+
*
74+
* @returns {Paging} Chainable.
75+
*/
76+
initialize: function () {
77+
this._super()
78+
.initSizes();
79+
80+
return this;
81+
},
82+
83+
/**
84+
* Initializes sizes component.
85+
*
86+
* @returns {Paging} Chainable.
87+
*/
88+
initSizes: function () {
89+
if (this.sizesConfig.enabled) {
90+
layout([this.sizesConfig]);
91+
}
92+
93+
return this;
94+
},
95+
3096
/**
3197
* Handler for type select.
3298
*
@@ -104,6 +170,17 @@ define([
104170
}
105171

106172
this._super();
173+
},
174+
175+
/**
176+
* Handles changes of the page size.
177+
*/
178+
onPageSizeChange: function () {
179+
resolver(function () {
180+
if (this.elems().length) {
181+
this.reload();
182+
}
183+
}, this);
107184
}
108185
});
109186
});

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

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
32
/**
4-
* Import entity of bundle product type
5-
*
63
* Copyright © Magento, Inc. All rights reserved.
74
* See COPYING.txt for license details.
85
*/
@@ -29,25 +26,25 @@ class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\Abst
2926
/**
3027
* Delimiter before product option value.
3128
*/
32-
const BEFORE_OPTION_VALUE_DELIMITER = ';';
29+
public const BEFORE_OPTION_VALUE_DELIMITER = ';';
3330

34-
const PAIR_VALUE_SEPARATOR = '=';
31+
public const PAIR_VALUE_SEPARATOR = '=';
3532

3633
/**
3734
* Dynamic value.
3835
*/
39-
const VALUE_DYNAMIC = 'dynamic';
36+
public const VALUE_DYNAMIC = 'dynamic';
4037

4138
/**
4239
* Fixed value.
4340
*/
44-
const VALUE_FIXED = 'fixed';
41+
public const VALUE_FIXED = 'fixed';
4542

46-
const NOT_FIXED_DYNAMIC_ATTRIBUTE = 'price_view';
43+
public const NOT_FIXED_DYNAMIC_ATTRIBUTE = 'price_view';
4744

48-
const SELECTION_PRICE_TYPE_FIXED = 0;
45+
public const SELECTION_PRICE_TYPE_FIXED = 0;
4946

50-
const SELECTION_PRICE_TYPE_PERCENT = 1;
47+
public const SELECTION_PRICE_TYPE_PERCENT = 1;
5148

5249
/**
5350
* Array of cached options.
@@ -89,9 +86,9 @@ class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\Abst
8986
];
9087

9188
/**
92-
* Custom fields mapping.
89+
* Custom fields mapping for bundle product.
9390
*
94-
* @inherited
91+
* @var array
9592
*/
9693
protected $_customFieldsMapping = [
9794
'price_type' => 'bundle_price_type',
@@ -102,7 +99,7 @@ class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\Abst
10299
];
103100

104101
/**
105-
* Bundle field mapping.
102+
* Bundle field mapping for bundle product with selection.
106103
*
107104
* @var array
108105
*/
@@ -113,7 +110,7 @@ class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\Abst
113110
];
114111

115112
/**
116-
* Option type mapping.
113+
* Option type mapping for bundle product.
117114
*
118115
* @var array
119116
*/
@@ -202,11 +199,7 @@ protected function parseSelections($rowData, $entityId)
202199
$this->_cachedOptions[$entityId][$option['name']]['selections'] = [];
203200
}
204201
$this->_cachedOptions[$entityId][$option['name']]['selections'][] = $option;
205-
$this->_cachedOptionSelectQuery[] =
206-
$this->connection->quoteInto(
207-
'(parent_id = ' . (int)$entityId . ' AND title = ?)',
208-
$option['name']
209-
);
202+
$this->_cachedOptionSelectQuery[] = [(int)$entityId, $option['name']];
210203
}
211204
}
212205
return $selections;
@@ -477,18 +470,24 @@ protected function transformBundleCustomAttributes($rowData)
477470
*/
478471
protected function populateExistingOptions()
479472
{
480-
$existingOptions = $this->connection->fetchAssoc(
481-
$this->connection->select()->from(
482-
['bo' => $this->_resource->getTableName('catalog_product_bundle_option')],
483-
['option_id', 'parent_id', 'required', 'position', 'type']
484-
)->joinLeft(
485-
['bov' => $this->_resource->getTableName('catalog_product_bundle_option_value')],
486-
'bo.option_id = bov.option_id',
487-
['value_id', 'title']
488-
)->where(
489-
implode(' OR ', $this->_cachedOptionSelectQuery)
490-
)
473+
$select = $this->connection->select()->from(
474+
['bo' => $this->_resource->getTableName('catalog_product_bundle_option')],
475+
['option_id', 'parent_id', 'required', 'position', 'type']
476+
)->joinLeft(
477+
['bov' => $this->_resource->getTableName('catalog_product_bundle_option_value')],
478+
'bo.option_id = bov.option_id',
479+
['value_id', 'title']
491480
);
481+
$orWhere = false;
482+
foreach ($this->_cachedOptionSelectQuery as $item) {
483+
if ($orWhere) {
484+
$select->orWhere('parent_id = '.$item[0].' AND title = ?', $item[1]);
485+
} else {
486+
$select->where('parent_id = '.$item[0].' AND title = ?', $item[1]);
487+
$orWhere = true;
488+
}
489+
}
490+
$existingOptions = $this->connection->fetchAssoc($select);
492491
foreach ($existingOptions as $optionId => $option) {
493492
$this->_cachedOptions[$option['parent_id']][$option['title']]['option_id'] = $optionId;
494493
foreach ($option as $key => $value) {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<actionGroup name="AdminOpenAndApplyCustomOptionsPerPageActionGroup">
12+
<annotations>
13+
<description>Open the custom option drop down section and assign the user defined custom value</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="perPageInputValue" type="string" defaultValue="1"/>
17+
</arguments>
18+
19+
<click selector="{{AdminProductGridPaginationSection.perPageDropdown}}" stepKey="clickProductPerPageDropdown"/>
20+
<click selector="{{AdminProductGridPaginationSection.perPageOption('Custom')}}" stepKey="selectCustomPerPage"/>
21+
<fillField selector="{{AdminProductGridPaginationSection.perPageInput}}" userInput="{{perPageInputValue}}" stepKey="fillCustomPerPage"/>
22+
<click selector="{{AdminProductGridPaginationSection.perPageApplyInput}}" stepKey="applyCustomPerPage"/>
23+
<waitForPageLoad stepKey="waitForPageRefreshCustomPerPage"/>
24+
</actionGroup>
25+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@
5757
<element name="optionSku" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr//*[@name='product[options][{{index}}][sku]']" parameterized="true"/>
5858
<element name="optionFileExtensions" type="input" selector="//*[@data-index='custom_options']//*[@data-index='options']/tbody/tr//*[@name='product[options][{{index}}][file_extension]']" parameterized="true"/>
5959
<element name="importOptions" type="button" selector="//button[@data-index='button_import']" timeout="30"/>
60+
<element name="customOptionTableRows" type="button" selector=".admin__dynamic-rows[data-index='values'] tr.data-row" timeout="30"/>
6061
</section>
6162
</sections>

0 commit comments

Comments
 (0)