Skip to content

Commit 5a78f21

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents 6a06383 + bf71446 commit 5a78f21

File tree

6 files changed

+109
-11
lines changed

6 files changed

+109
-11
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ private function handleImageRemoveError($postData, $productId)
216216
/**
217217
* Do copying data to stores
218218
*
219+
* If the 'copy_from' field is not specified in the input data,
220+
* the store fallback mechanism will automatically take the admin store's default value.
221+
*
219222
* @param array $data
220223
* @param int $productId
221224
* @return void
@@ -227,15 +230,17 @@ protected function copyToStores($data, $productId)
227230
if (isset($data['product']['website_ids'][$websiteId])
228231
&& (bool)$data['product']['website_ids'][$websiteId]) {
229232
foreach ($group as $store) {
230-
$copyFrom = (isset($store['copy_from'])) ? $store['copy_from'] : 0;
231-
$copyTo = (isset($store['copy_to'])) ? $store['copy_to'] : 0;
232-
if ($copyTo) {
233-
$this->_objectManager->create(\Magento\Catalog\Model\Product::class)
234-
->setStoreId($copyFrom)
235-
->load($productId)
236-
->setStoreId($copyTo)
237-
->setCopyFromView(true)
238-
->save();
233+
if (isset($store['copy_from'])) {
234+
$copyFrom = $store['copy_from'];
235+
$copyTo = (isset($store['copy_to'])) ? $store['copy_to'] : 0;
236+
if ($copyTo) {
237+
$this->_objectManager->create(\Magento\Catalog\Model\Product::class)
238+
->setStoreId($copyFrom)
239+
->load($productId)
240+
->setStoreId($copyTo)
241+
->setCopyFromView(true)
242+
->save();
243+
}
239244
}
240245
}
241246
}

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeOptionData.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
<entity name="ProductAttributeOptionGetter" type="ProductAttributeOption">
2828
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
2929
</entity>
30+
<entity name="productAttributeOption" type="ProductAttributeOption">
31+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
32+
<data key="label" unique="suffix">customOption</data>
33+
<data key="is_default">false</data>
34+
<data key="sort_order">0</data>
35+
</entity>
3036
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
<element name="productStatus" type="checkbox" selector="input[name='product[status]']"/>
1717
<element name="enableProductLabel" type="checkbox" selector="input[name='product[status]']+label"/>
1818
<element name="productStatusUseDefault" type="checkbox" selector="input[name='use_default[status]']"/>
19+
<element name="productNameUseDefault" type="checkbox" selector="input[name='use_default[name]']"/>
1920
<element name="productPrice" type="input" selector=".admin__field[data-index=price] input"/>
21+
<element name="productTaxClassUseDefault" type="checkbox" selector="input[name='use_default[tax_class_id]']"/>
2022
<element name="advancedPricingLink" type="button" selector="button[data-index='advanced_pricing_button']"/>
2123
<element name="categoriesDropdown" type="multiselect" selector="div[data-index='category_ids']"/>
2224
<element name="productQuantity" type="input" selector=".admin__field[data-index=qty] input"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
11+
<test name="AdminMultipleWebsitesUseDefaultValuesTest">
12+
<annotations>
13+
<title value="Use Default Value checkboxes should be checked for new website scope"/>
14+
<description value="Use Default Value checkboxes for product attribute should be checked for new website scope"/>
15+
<severity value="MAJOR"/>
16+
<testCaseId value="MAGETWO-92454"/>
17+
<group value="Catalog"/>
18+
</annotations>
19+
<after>
20+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
21+
<argument name="websiteName" value="Second Website"/>
22+
</actionGroup>
23+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
24+
</after>
25+
<actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/>
26+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
27+
<argument name="newWebsiteName" value="Second Website"/>
28+
<argument name="websiteCode" value="second_website"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
31+
<argument name="website" value="Second Website"/>
32+
<argument name="storeGroupName" value="Second Store"/>
33+
<argument name="storeGroupCode" value="second_store"/>
34+
</actionGroup>
35+
36+
<!--Create Store view -->
37+
<amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/>
38+
<click selector="{{AdminStoresMainActionsSection.createStoreViewButton}}" stepKey="createStoreViewButton"/>
39+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
40+
<selectOption userInput="Second Store" selector="{{AdminNewStoreSection.storeGrpDropdown}}" stepKey="selectStoreGroup"/>
41+
<fillField userInput="Second Store View" selector="{{AdminNewStoreSection.storeNameTextField}}" stepKey="fillStoreViewName"/>
42+
<fillField userInput="second_store_view" selector="{{AdminNewStoreSection.storeCodeTextField}}" stepKey="fillStoreViewCode"/>
43+
<selectOption selector="{{AdminNewStoreSection.statusDropdown}}" userInput="1" stepKey="enableStoreViewStatus"/>
44+
<click selector="{{AdminStoresMainActionsSection.saveButton}}" stepKey="clickStoreViewSaveButton"/>
45+
<waitForElementVisible selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" stepKey="waitForAcceptNewStoreViewCreationModal" />
46+
<conditionalClick selector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" dependentSelector="{{AdminNewStoreSection.acceptNewStoreViewCreation}}" visible="true" stepKey="AcceptNewStoreViewCreation"/>
47+
<waitForElementVisible selector="{{AdminStoresGridSection.storeFilterTextField}}" stepKey="waitForPageReload"/>
48+
<see userInput="You saved the store view." stepKey="seeSaveMessage"/>
49+
50+
<!--Create a Simple Product -->
51+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToCatalogProductGrid"/>
52+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
53+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
54+
<fillField userInput="{{_defaultProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillProductName"/>
55+
<fillField userInput="{{_defaultProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillProductSKU"/>
56+
<fillField userInput="{{_defaultProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillProductPrice"/>
57+
<fillField userInput="{{_defaultProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillProductQuantity"/>
58+
59+
<!-- Add product to second website and save the product -->
60+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="openProductInWebsites"/>
61+
<click selector="{{ProductInWebsitesSection.website('Second Website')}}" stepKey="selectSecondWebsite"/>
62+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/>
63+
<waitForLoadingMaskToDisappear stepKey="waitForProductPageSave"/>
64+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="seeSaveProductMessage"/>
65+
66+
<!-- switch to the second store view -->
67+
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
68+
<click selector="{{AdminProductFormActionSection.selectStoreView('Second Store View')}}" stepKey="chooseStoreView"/>
69+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
70+
<!--<waitForPageLoad stepKey="waitForStoreViewSwitched"/>-->
71+
<waitForPageLoad time="30" stepKey="waitForPageLoad9"/>
72+
<see userInput="Second Store View" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewStoreViewName"/>
73+
74+
<!-- Check if Use Default Value checkboxes are checked -->
75+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productStatusUseDefault}}" stepKey="seeProductStatusCheckboxChecked"/>
76+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productNameUseDefault}}" stepKey="seeProductNameCheckboxChecked"/>
77+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.productTaxClassUseDefault}}" stepKey="seeTaxClassCheckboxChecked"/>
78+
<seeCheckboxIsChecked selector="{{AdminProductFormSection.visibilityUseDefault}}" stepKey="seeVisibilityCheckboxChecked"/>
79+
</test>
80+
</tests>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
7474
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
7575
<actionGroup ref="ResetWebUrlOptions" stepKey="resetUrlOption"/>
76-
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"/>
76+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite">
77+
<argument name="websiteName" value="Second Website"/>
78+
</actionGroup>
7779
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
7880
</after>
7981

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Sales/ActionGroup/AdminOrderGridActionGroup.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
1111
<!--Filter order grid by order id field-->
1212
<actionGroup name="filterOrderGridById">
13+
<arguments>
14+
<argument name="orderId" type="string"/>
15+
</arguments>
1316
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderGridPage"/>
1417
<waitForPageLoad stepKey="waitForOrderGridLoad"/>
1518
<conditionalClick selector="{{AdminOrdersGridSection.clearFilters}}" dependentSelector="{{AdminOrdersGridSection.clearFilters}}" visible="true" stepKey="clearExistingOrderFilters"/>
1619
<click selector="{{AdminOrdersGridSection.filters}}" stepKey="openOrderGridFilters"/>
17-
<fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="$getOrderId" stepKey="fillOrderIdFilter"/>
20+
<fillField selector="{{AdminOrdersGridSection.idFilter}}" userInput="{{orderId}}" stepKey="fillOrderIdFilter"/>
1821
<click selector="{{AdminOrdersGridSection.applyFilters}}" stepKey="clickOrderApplyFilters"/>
1922
</actionGroup>
2023

0 commit comments

Comments
 (0)