Skip to content

Commit 9dbaaad

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MC-23215
2 parents 53de67e + 148d6cc commit 9dbaaad

File tree

12 files changed

+267
-9
lines changed

12 files changed

+267
-9
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
default :?>
131131
<?php if (is_string($block->getProductAttributeValue($item, $attribute))) :?>
132132
<?= /* @noEscape */ $helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode()) ?>
133+
<?php else : ?>
134+
<?= $block->escapeHtml($helper->productAttribute($item, $block->getProductAttributeValue($item, $attribute), $attribute->getAttributeCode())) ?>
133135
<?php endif; ?>
134136
<?php break;
135137
} ?>

app/code/Magento/CatalogImportExport/Model/Import/Product/Option.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,9 @@ protected function _parseCustomOptions($rowData)
20862086
}
20872087
}
20882088
}
2089-
$options[$name][$k]['_custom_option_store'] = $rowData[Product::COL_STORE_VIEW_CODE];
2089+
if (isset($rowData[Product::COL_STORE_VIEW_CODE])) {
2090+
$options[$name][$k][self::COLUMN_STORE] = $rowData[Product::COL_STORE_VIEW_CODE];
2091+
}
20902092
$k++;
20912093
}
20922094
$rowData['custom_options'] = $options;

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,77 @@ public function testValidateAmbiguousData(
776776
$this->assertEquals($errors, $resultErrors);
777777
}
778778

779+
/**
780+
* Test for row without store view code field
781+
* @param array $rowData
782+
* @param array $responseData
783+
*
784+
* @covers \Magento\CatalogImportExport\Model\Import\Product\Option::_parseCustomOptions
785+
* @dataProvider validateRowStoreViewCodeFieldDataProvider
786+
*/
787+
public function testValidateRowDataForStoreViewCodeField($rowData, $responseData)
788+
{
789+
$reflection = new \ReflectionClass(\Magento\CatalogImportExport\Model\Import\Product\Option::class);
790+
$reflectionMethod = $reflection->getMethod('_parseCustomOptions');
791+
$reflectionMethod->setAccessible(true);
792+
$result = $reflectionMethod->invoke($this->model, $rowData);
793+
$this->assertEquals($responseData, $result);
794+
}
795+
796+
/**
797+
* Data provider for test of method _parseCustomOptions
798+
*
799+
* @return array
800+
*/
801+
public function validateRowStoreViewCodeFieldDataProvider()
802+
{
803+
return [
804+
'with_store_view_code' => [
805+
'$rowData' => [
806+
'store_view_code' => '',
807+
'custom_options' =>
808+
'name=Test Field Title,type=field,required=1;sku=1-text,price=0,price_type=fixed'
809+
],
810+
'$responseData' => [
811+
'store_view_code' => '',
812+
'custom_options' => [
813+
'Test Field Title' => [
814+
[
815+
'name' => 'Test Field Title',
816+
'type' => 'field',
817+
'required' => '1',
818+
'sku' => '1-text',
819+
'price' => '0',
820+
'price_type' => 'fixed',
821+
'_custom_option_store' => ''
822+
]
823+
]
824+
]
825+
],
826+
],
827+
'without_store_view_code' => [
828+
'$rowData' => [
829+
'custom_options' =>
830+
'name=Test Field Title,type=field,required=1;sku=1-text,price=0,price_type=fixed'
831+
],
832+
'$responseData' => [
833+
'custom_options' => [
834+
'Test Field Title' => [
835+
[
836+
'name' => 'Test Field Title',
837+
'type' => 'field',
838+
'required' => '1',
839+
'sku' => '1-text',
840+
'price' => '0',
841+
'price_type' => 'fixed'
842+
]
843+
]
844+
]
845+
],
846+
]
847+
];
848+
}
849+
779850
/**
780851
* Data provider of row data and errors
781852
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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="AdminChangeConfigurableProductVariationQty">
12+
<annotations>
13+
<description>Change quantity value for configurable product generated variation</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="rowIndex" type="string" defaultValue="0"/>
17+
<argument name="quantity" type="string" defaultValue="0"/>
18+
</arguments>
19+
<fillField selector="{{AdminCreateProductConfigurationsPanel.variationQty(rowIndex)}}" userInput="{{quantity}}" stepKey="fillVariationQuantity"/>
20+
</actionGroup>
21+
</actionGroups>
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="AdminFilterAttributeInConfigurableAttributesGrid">
12+
<annotations>
13+
<description>Filter attribute in configurable attributes grid by attribute code value</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeCode" type="string" defaultValue="{{newProductAttribute.attribute_code}}"/>
17+
</arguments>
18+
<conditionalClick selector="{{AdminDataGridFilterSection.clear}}" visible="true" dependentSelector="{{AdminDataGridFilterSection.clear}}" stepKey="clearFilters"/>
19+
<waitForPageLoad stepKey="waitForFiltersReset"/>
20+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="waitForFiltersAppear"/>
21+
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="expandFilters"/>
22+
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterValue"/>
23+
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFilters"/>
24+
</actionGroup>
25+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="AdminSelectAttributeInConfigurableAttributesGrid" extends="AdminFilterAttributeInConfigurableAttributesGrid">
12+
<annotations>
13+
<description>EXTENDS: AdminFilterAttributeInConfigurableAttributesGrid. Select first filtered attribute.</description>
14+
</annotations>
15+
<click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="checkAttributeInGrid"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<element name="applyFilters" type="button" selector="button[data-action='grid-filter-apply']" timeout="30"/>
1818
<element name="firstCheckbox" type="input" selector="tr[data-repeat-index='0'] .admin__control-checkbox"/>
1919
<element name="id" type="text" selector="//tr[contains(@data-repeat-index, '0')]/td[2]/div"/>
20+
<element name="variationsGrid" type="block" selector=".admin__field[data-index='configurable-matrix']"/>
21+
<element name="variationQty" type="input" selector=".admin__field[data-index='configurable-matrix'] input[name='configurable-matrix[{{rowIndex}}][qty]']" parameterized="true"/>
2022
<element name="attributeCheckbox" type="checkbox" selector="//div[contains(text(), '{{arg}}')]/ancestor::tr//input[@data-action='select-row']" parameterized="true"/>
2123
<element name="defaultLabel" type="text" selector="//div[contains(text(), '{{arg}}')]/ancestor::tr//td[3]/div[@class='data-grid-cell-content']" parameterized="true"/>
2224

app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,108 @@
178178
<click selector="{{StorefrontProductInfoMainSection.AddToCart}}" stepKey="clickAddToCart" />
179179
<see userInput="This is a required field" selector="{{StorefrontProductInfoMainSection.productAttributeOptionsError}}" stepKey="seeError"/>
180180
</test>
181+
182+
<test name="StorefrontConfigurableProductVariationsTest">
183+
<annotations>
184+
<features value="ConfigurableProduct"/>
185+
<stories value="Configurable Product"/>
186+
<title value="Customer should get the right options list"/>
187+
<description value="Customer should get the right options list for each variation of configurable product"/>
188+
<severity value="CRITICAL"/>
189+
<testCaseId value="MC-23027"/>
190+
<useCaseId value="MC-22732"/>
191+
<group value="configurable_product"/>
192+
</annotations>
193+
194+
<before>
195+
<createData entity="ApiCategory" stepKey="createCategory"/>
196+
<!-- Add first attribute with options -->
197+
<createData entity="productAttributeWithTwoOptions" stepKey="createFirstAttribute"/>
198+
<createData entity="productAttributeOption1" stepKey="createFirstAttributeFirstOption">
199+
<requiredEntity createDataKey="createFirstAttribute"/>
200+
</createData>
201+
<createData entity="productAttributeOption2" stepKey="createFirstAttributeSecondOption">
202+
<requiredEntity createDataKey="createFirstAttribute"/>
203+
</createData>
204+
<!-- Add second attribute with options -->
205+
<createData entity="productAttributeWithTwoOptions" stepKey="createSecondAttribute"/>
206+
<createData entity="productAttributeOption1" stepKey="createSecondAttributeFirstOption">
207+
<requiredEntity createDataKey="createSecondAttribute"/>
208+
</createData>
209+
<createData entity="productAttributeOption2" stepKey="createSecondAttributeSecondOption">
210+
<requiredEntity createDataKey="createSecondAttribute"/>
211+
</createData>
212+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
213+
</before>
214+
<after>
215+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
216+
<actionGroup ref="deleteProductBySku" stepKey="deleteProduct">
217+
<argument name="sku" value="{{BaseConfigurableProduct.sku}}"/>
218+
</actionGroup>
219+
<deleteData createDataKey="createFirstAttribute" stepKey="deleteFirstAttribute"/>
220+
<deleteData createDataKey="createSecondAttribute" stepKey="deleteSecondAttribute"/>
221+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductsGridFilters"/>
222+
<actionGroup ref="logout" stepKey="adminLogout"/>
223+
</after>
224+
225+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/>
226+
<actionGroup ref="goToCreateProductPage" stepKey="navigateToCreateProductPage">
227+
<argument name="product" value="BaseConfigurableProduct"/>
228+
</actionGroup>
229+
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm">
230+
<argument name="product" value="BaseConfigurableProduct"/>
231+
</actionGroup>
232+
<actionGroup ref="SetCategoryByName" stepKey="addCategoryToProduct">
233+
<argument name="categoryName" value="$createCategory.name$"/>
234+
</actionGroup>
235+
<actionGroup ref="SetProductUrlKeyByString" stepKey="fillUrlKey">
236+
<argument name="urlKey" value="{{BaseConfigurableProduct.urlKey}}"/>
237+
</actionGroup>
238+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickOnCreateConfigurations"/>
239+
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="checkFirstAttribute">
240+
<argument name="attributeCode" value="$createFirstAttribute.attribute_code$"/>
241+
</actionGroup>
242+
<actionGroup ref="AdminSelectAttributeInConfigurableAttributesGrid" stepKey="checkSecondAttribute">
243+
<argument name="attributeCode" value="$createSecondAttribute.attribute_code$"/>
244+
</actionGroup>
245+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/>
246+
<waitForPageLoad stepKey="waitForStepLoad"/>
247+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute($createFirstAttribute.default_frontend_label$)}}" stepKey="clickFirstAttributeSelectAll"/>
248+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute($createSecondAttribute.default_frontend_label$)}}" stepKey="clickSecondAttributeSelectAll"/>
249+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickSecondNextStep"/>
250+
<waitForElement selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitThirdNextButton"/>
251+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickThirdStep"/>
252+
<waitForElement selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="waitGenerateConfigurationsButton"/>
253+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickToGenerateConfigurations"/>
254+
255+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.variationsGrid}}" stepKey="waitForVariationsGrid"/>
256+
<actionGroup ref="AdminChangeConfigurableProductVariationQty" stepKey="setFirstVariationQuantity">
257+
<argument name="rowIndex" value="0"/>
258+
<argument name="quantity" value="0"/>
259+
</actionGroup>
260+
<actionGroup ref="AdminChangeConfigurableProductVariationQty" stepKey="setSecondVariationQuantity">
261+
<argument name="rowIndex" value="1"/>
262+
<argument name="quantity" value="1"/>
263+
</actionGroup>
264+
<actionGroup ref="AdminChangeConfigurableProductVariationQty" stepKey="setThirdVariationQuantity">
265+
<argument name="rowIndex" value="2"/>
266+
<argument name="quantity" value="1"/>
267+
</actionGroup>
268+
<actionGroup ref="AdminChangeConfigurableProductVariationQty" stepKey="setFourthVariationQuantity">
269+
<argument name="rowIndex" value="3"/>
270+
<argument name="quantity" value="1"/>
271+
</actionGroup>
272+
<actionGroup ref="saveConfigurableProduct" stepKey="saveConfigurableProduct">
273+
<argument name="product" value="BaseConfigurableProduct"/>
274+
</actionGroup>
275+
<scrollTo selector="{{AdminProductSEOSection.sectionHeader}}" x="0" y="-80" stepKey="scrollToAdminProductSEOSection"/>
276+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="clickAdminProductSEOSectionHeader"/>
277+
<grabValueFrom selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="grabUrlKey"/>
278+
<amOnPage url="{$grabUrlKey}.html" stepKey="amOnConfigurableProductPage"/>
279+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
280+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productOptionSelect($createFirstAttribute.default_frontend_label$)}}" stepKey="waitForFirstSelect"/>
281+
<selectOption userInput="$createFirstAttributeFirstOption.option[store_labels][0][label]$" selector="{{StorefrontProductInfoMainSection.productOptionSelect($createFirstAttribute.default_frontend_label$)}}" stepKey="selectFirstAttributeFirstOption"/>
282+
<waitForElementVisible selector="{{StorefrontProductInfoMainSection.productOptionSelect($createSecondAttribute.default_frontend_label$)}}" stepKey="waitForSecondSelect"/>
283+
<selectOption userInput="$createSecondAttributeSecondOption.option[store_labels][0][label]$" selector="{{StorefrontProductInfoMainSection.productOptionSelect($createSecondAttribute.default_frontend_label$)}}" stepKey="selectSecondAttributeSecondOption"/>
284+
</test>
181285
</tests>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ define([
443443
}
444444

445445
for (i = 0; i < options.length; i++) {
446+
if (prevConfig && typeof allowedProductsByOption[i] === 'undefined') {
447+
continue; //jscs:ignore disallowKeywords
448+
}
449+
446450
allowedProducts = prevConfig ? allowedProductsByOption[i] : options[i].products.slice(0);
447451
optionPriceDiff = 0;
448452

app/code/Magento/Msrp/view/base/web/js/msrp.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,11 @@ define([
352352
$(this.options.mapInfoLinks).show();
353353

354354
if (useDefaultPrice || !this.wasOpened) {
355-
this.$popup.find(this.options.msrpLabelId).html(options.msrpPrice);
356-
this.$popup.find(this.options.priceLabelId).html(options.realPrice);
355+
if (this.$popup) {
356+
this.$popup.find(this.options.msrpLabelId).html(options.msrpPrice);
357+
this.$popup.find(this.options.priceLabelId).html(options.realPrice);
358+
}
359+
357360
$(this.options.displayPriceElement).html(msrpPrice);
358361
this.wasOpened = true;
359362
}

0 commit comments

Comments
 (0)