Skip to content

Commit 4e11084

Browse files
authored
Merge pull request #3732 from magento-epam/EPAM-PR-41
* [MAGETWO-95811](https://jira.corp.magento.com/browse/MAGETWO-95811) Cannot translate specific admin sections with inline translation * [MAGETWO-95827](https://jira.corp.magento.com/browse/MAGETWO-95827) Changing Attribute Set may lead to exception "Attempt to load value of nonexistent EAV attribute" * [MAGETWO-91696](https://jira.corp.magento.com/browse/MAGETWO-91696) Configurable product type issue when adding to order * [MAGETWO-97311](https://jira.corp.magento.com/browse/MAGETWO-97311) 2.3 only - creating attribute option value using API returns unexpected response * [MAGETWO-59055](https://jira.corp.magento.com/browse/MAGETWO-59055) Can't Create New Attribute from Product * [MC-10973](https://jira.corp.magento.com/browse/MC-10973) Simple product with MAP assigned to configurable should displays the same way as products with special price * [MC-10971](https://jira.corp.magento.com/browse/MC-10971) [Magento Cloud] - Unable to Scope Catalog Price rules by custom product attribute * [MC-4981](https://jira.corp.magento.com/browse/MC-4981) Changing Number of Products To Display Requires Cache Refresh * [MC-5906](https://jira.corp.magento.com/browse/MC-5906) The order of product SKU is not respected * [MC-10950](https://jira.corp.magento.com/browse/MC-10950) 2.3 only - creating attribute option value using API returns unexpected response
2 parents 49a25f2 + 50d612c commit 4e11084

File tree

56 files changed

+1092
-121
lines changed

Some content is hidden

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

56 files changed

+1092
-121
lines changed

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ConditionBuilder/EavAttributeCondition.php

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,38 @@ public function build(Filter $filter): string
5858
$conditionValue = $this->mapConditionValue($conditionType, $filter->getValue());
5959

6060
// NOTE: store scope was ignored intentionally to perform search across all stores
61-
$attributeSelect = $this->resourceConnection->getConnection()
62-
->select()
63-
->from(
64-
[$tableAlias => $attribute->getBackendTable()],
65-
$tableAlias . '.' . $attribute->getEntityIdField()
66-
)->where(
67-
$this->resourceConnection->getConnection()->prepareSqlCondition(
68-
$tableAlias . '.' . $attribute->getIdFieldName(),
69-
['eq' => $attribute->getAttributeId()]
70-
)
71-
)->where(
72-
$this->resourceConnection->getConnection()->prepareSqlCondition(
73-
$tableAlias . '.value',
74-
[$conditionType => $conditionValue]
75-
)
76-
);
61+
if ($conditionType == 'is_null') {
62+
$entityResourceModel = $attribute->getEntity();
63+
$attributeSelect = $this->resourceConnection->getConnection()
64+
->select()
65+
->from(
66+
[Collection::MAIN_TABLE_ALIAS => $entityResourceModel->getEntityTable()],
67+
Collection::MAIN_TABLE_ALIAS . '.' . $entityResourceModel->getEntityIdField()
68+
)->joinLeft(
69+
[$tableAlias => $attribute->getBackendTable()],
70+
$tableAlias . '.' . $attribute->getEntityIdField() . '=' . Collection::MAIN_TABLE_ALIAS .
71+
'.' . $entityResourceModel->getEntityIdField() . ' AND ' . $tableAlias . '.' .
72+
$attribute->getIdFieldName() . '=' . $attribute->getAttributeId(),
73+
''
74+
)->where($tableAlias . '.value is null');
75+
} else {
76+
$attributeSelect = $this->resourceConnection->getConnection()
77+
->select()
78+
->from(
79+
[$tableAlias => $attribute->getBackendTable()],
80+
$tableAlias . '.' . $attribute->getEntityIdField()
81+
)->where(
82+
$this->resourceConnection->getConnection()->prepareSqlCondition(
83+
$tableAlias . '.' . $attribute->getIdFieldName(),
84+
['eq' => $attribute->getAttributeId()]
85+
)
86+
)->where(
87+
$this->resourceConnection->getConnection()->prepareSqlCondition(
88+
$tableAlias . '.value',
89+
[$conditionType => $conditionValue]
90+
)
91+
);
92+
}
7793

7894
return $this->resourceConnection
7995
->getConnection()
@@ -86,6 +102,8 @@ public function build(Filter $filter): string
86102
}
87103

88104
/**
105+
* Get attribute entity by its code
106+
*
89107
* @param string $field
90108
* @return Attribute
91109
* @throws \Magento\Framework\Exception\LocalizedException

app/code/Magento/Catalog/Model/Product/Attribute/DataProvider.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,28 @@ private function customizeAttributeCode($meta)
113113
*/
114114
private function customizeFrontendLabels($meta)
115115
{
116+
$labelConfigs = [];
117+
116118
foreach ($this->storeRepository->getList() as $store) {
117119
$storeId = $store->getId();
118120

119121
if (!$storeId) {
120122
continue;
121123
}
122-
123-
$meta['manage-titles']['children'] = [
124-
'frontend_label[' . $storeId . ']' => $this->arrayManager->set(
125-
'arguments/data/config',
126-
[],
127-
[
128-
'formElement' => Input::NAME,
129-
'componentType' => Field::NAME,
130-
'label' => $store->getName(),
131-
'dataType' => Text::NAME,
132-
'dataScope' => 'frontend_label[' . $storeId . ']'
133-
]
134-
),
135-
];
124+
$labelConfigs['frontend_label[' . $storeId . ']'] = $this->arrayManager->set(
125+
'arguments/data/config',
126+
[],
127+
[
128+
'formElement' => Input::NAME,
129+
'componentType' => Field::NAME,
130+
'label' => $store->getName(),
131+
'dataType' => Text::NAME,
132+
'dataScope' => 'frontend_label[' . $storeId . ']'
133+
]
134+
);
136135
}
136+
$meta['manage-titles']['children'] = $labelConfigs;
137+
137138
return $meta;
138139
}
139140

app/code/Magento/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ public function afterSave()
236236
) {
237237
$this->_indexerEavProcessor->markIndexerAsInvalid();
238238
}
239+
240+
$this->_source = null;
239241

240242
return parent::afterSave();
241243
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,41 @@
3030
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3" />
3131
<waitForPageLoad stepKey="waitForPageLoad3" />
3232
</actionGroup>
33+
34+
<actionGroup name="AdminCreateAttributeFromProductPage">
35+
<arguments>
36+
<argument name="attributeName" type="string"/>
37+
<argument name="attributeType" type="string" defaultValue="TextField"/>
38+
</arguments>
39+
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickAddAttributeBtn"/>
40+
<see userInput="Select Attribute" stepKey="checkNewAttributePopUpAppeared"/>
41+
<click selector="{{AdminProductFormAttributeSection.createNewAttribute}}" stepKey="clickCreateNewAttribute"/>
42+
<fillField selector="{{AdminProductFormNewAttributeSection.attributeLabel}}" userInput="{{attributeName}}" stepKey="fillAttributeLabel"/>
43+
<selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/>
44+
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/>
45+
</actionGroup>
46+
47+
<actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" extends="AdminCreateAttributeFromProductPage">
48+
<remove keyForRemoval="saveAttribute"/>
49+
<arguments>
50+
<argument name="firstStoreViewName" type="string"/>
51+
<argument name="secondStoreViewName" type="string"/>
52+
</arguments>
53+
<click selector="{{AdminProductFormNewAttributeSection.addValue}}" stepKey="addValue" after="selectAttributeType"/>
54+
<seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeFirstStoreView"/>
55+
<seeElement selector="{{AdminProductFormNewAttributeSection.optionViewName(firstStoreViewName))}}" stepKey="seeSecondStoreView"/>
56+
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('1'))}}" userInput="default" stepKey="fillDefaultStoreView"/>
57+
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('2'))}}" userInput="admin" stepKey="fillAdminStoreView"/>
58+
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('3'))}}" userInput="view1" stepKey="fillFirstStoreView"/>
59+
<fillField selector="{{AdminProductFormNewAttributeSection.optionValue('4'))}}" userInput="view2" stepKey="fillSecondStoreView"/>
60+
61+
<!--Check store view in Manage Titles section-->
62+
<click selector="{{AdminProductFormNewAttributeSection.manageTitlesHeader}}" stepKey="openManageTitlesSection"/>
63+
<seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreEN.name)}}" stepKey="seeFirstStoreViewName"/>
64+
<seeElement selector="{{AdminProductFormNewAttributeSection.manageTitlesViewName(customStoreFR.name)}}" stepKey="seeSecondStoreViewName"/>
65+
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute1"/>
66+
</actionGroup>
67+
3368
<actionGroup name="changeUseForPromoRuleConditionsProductAttribute">
3469
<arguments>
3570
<argument name="option" type="string"/>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
11+
<actionGroup name="CompareTwoProductsOrder">
12+
<arguments>
13+
<argument name="product_1"/>
14+
<argument name="product_2"/>
15+
</arguments>
16+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
17+
<waitForPageLoad stepKey="waitForPageLoad5"/>
18+
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('1')}}" userInput="alt" stepKey="grabFirstProductName1_1"/>
19+
<assertEquals expected="{{product_1.name}}" actual="($grabFirstProductName1_1)" message="notExpectedOrder" stepKey="compare1"/>
20+
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('2')}}" userInput="alt" stepKey="grabFirstProductName2_2"/>
21+
<assertEquals expected="{{product_2.name}}" actual="($grabFirstProductName2_2)" message="notExpectedOrder" stepKey="compare2"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,27 @@
115115
<data key="used_for_sort_by">true</data>
116116
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
117117
</entity>
118+
<entity name="productYesNoAttribute" type="ProductAttribute">
119+
<data key="attribute_code" unique="suffix">attribute</data>
120+
<data key="frontend_input">boolean</data>
121+
<data key="scope">global</data>
122+
<data key="is_required">false</data>
123+
<data key="is_unique">false</data>
124+
<data key="is_searchable">true</data>
125+
<data key="is_visible">true</data>
126+
<data key="is_visible_in_advanced_search">true</data>
127+
<data key="is_visible_on_front">true</data>
128+
<data key="is_filterable">true</data>
129+
<data key="is_filterable_in_search">true</data>
130+
<data key="used_in_product_listing">true</data>
131+
<data key="is_used_for_promo_rules">true</data>
132+
<data key="is_comparable">true</data>
133+
<data key="is_used_in_grid">true</data>
134+
<data key="is_visible_in_grid">true</data>
135+
<data key="is_filterable_in_grid">true</data>
136+
<data key="used_for_sort_by">true</data>
137+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
138+
</entity>
118139
<entity name="productAttributeText" type="ProductAttribute">
119140
<data key="attribute_code" unique="suffix">attribute</data>
120141
<data key="frontend_input">text</data>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@
149149
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
150150
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
151151
</entity>
152+
<entity name="ApiSimpleProductWithPrice50" type="product2" extends="ApiSimpleOne">
153+
<data key="price">50</data>
154+
</entity>
155+
<entity name="ApiSimpleProductWithPrice60" type="product2" extends="ApiSimpleTwo">
156+
<data key="price">60</data>
157+
</entity>
158+
<entity name="ApiSimpleProductWithPrice70" type="product2" extends="SimpleOne">
159+
<data key="price">70</data>
160+
</entity>
152161
<entity name="ApiSimpleTwoHidden" type="product2">
153162
<data key="sku" unique="suffix">api-simple-product-two</data>
154163
<data key="type_id">simple</data>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<element name="productTierPricePercentageValuePriceInput" type="input" selector="[name='product[tier_price][{{var1}}][percentage_value]']" parameterized="true"/>
2121
<element name="specialPrice" type="input" selector="input[name='product[special_price]']"/>
2222
<element name="doneButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-primary" timeout="5"/>
23+
<element name="msrp" type="input" selector="//input[@name='product[msrp]']" timeout="30"/>
2324
<element name="save" type="button" selector="#save-button"/>
2425
</section>
2526
</sections>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminProductFormAttributeSection">
12+
<element name="createNewAttribute" type="button" selector="//button[@data-index='add_new_attribute_button']" timeout="30"/>
13+
</section>
14+
<section name="AdminProductFormNewAttributeSection">
15+
<element name="attributeLabel" type="button" selector="//input[@name='frontend_label[0]']" timeout="30"/>
16+
<element name="attributeType" type="select" selector="//select[@name='frontend_input']" timeout="30"/>
17+
<element name="addValue" type="button" selector="//button[@data-action='add_new_row']" timeout="30"/>
18+
<element name="optionViewName" type="text" selector="//table[@data-index='attribute_options_select']//span[contains(text(), '{{arg}}')]" parameterized="true" timeout="30"/>
19+
<element name="optionValue" type="input" selector="(//input[contains(@name, 'option[value]')])[{{arg}}]" timeout="30" parameterized="true"/>
20+
<element name="manageTitlesHeader" type="button" selector="//div[@class='fieldset-wrapper-title']//span[contains(text(), 'Manage Titles')]" timeout="30/"/>
21+
<element name="manageTitlesViewName" type="text" selector="//div[@data-index='manage-titles']//span[contains(text(), '{{arg}}')]" timeout="30" parameterized="true"/>
22+
<element name="saveAttribute" type="button" selector="button#save" timeout="30"/>
23+
</section>
24+
</sections>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,9 @@
189189
<element name="doneButton" type="button" selector=".product_form_product_form_advanced_pricing_modal button.action-primary"/>
190190
<element name="useDefaultPrice" type="checkbox" selector="//input[@name='product[special_price]']/parent::div/following-sibling::div/input[@name='use_default[special_price]']"/>
191191
</section>
192+
<section name="AdminProductAttributeSection">
193+
<element name="attributeSectionHeader" type="button" selector="//div[@data-index='attributes']" timeout="30"/>
194+
<element name="dropDownAttribute" type="select" selector="//select[@name='product[{{arg}}]']" parameterized="true" timeout="30"/>
195+
<element name="attributeSection" type="div" selector="//div[@data-index='attributes']/div[contains(@class, 'admin__collapsible-content _show')]" timeout="30"/>
196+
</section>
192197
</sections>

0 commit comments

Comments
 (0)