Skip to content

Commit d440559

Browse files
authored
Merge pull request #4337 from magento-epam/EPAM-PR-56
- fixed MAGETWO-98635 Multiple wishlists not supporting with Recently view widget or etc - fixed MAGETWO-98748 Incorrect behavior in the category menu on the Storefront - fixed MAGETWO-88965 Magento\Test\Legacy\LayoutTest is failing for B2B - fixed MAGETWO-72172 [2.3] Disabled variation of the configurable product can be added to a shopping cart via admin - fixed MAGETWO-64923 Duplicate products not showing on the frontend - fixed MAGETWO-99509 Download Option not working in Exports
2 parents 9b8849d + f8dd498 commit d440559

File tree

22 files changed

+525
-25
lines changed

22 files changed

+525
-25
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Multistore.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Backend\Block\Widget\Grid\Column;
79

810
/**
@@ -14,15 +16,6 @@
1416
*/
1517
class Multistore extends \Magento\Backend\Block\Widget\Grid\Column
1618
{
17-
/**
18-
* @param \Magento\Backend\Block\Template\Context $context
19-
* @param array $data
20-
*/
21-
public function __construct(\Magento\Backend\Block\Template\Context $context, array $data = [])
22-
{
23-
parent::__construct($context, $data);
24-
}
25-
2619
/**
2720
* Get header css class name
2821
*

app/code/Magento/Catalog/Helper/Product.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/**
1515
* Catalog category helper
1616
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1718
*/
1819
class Product extends \Magento\Framework\Url\Helper\Data
1920
{
@@ -268,6 +269,8 @@ public function getThumbnailUrl($product)
268269
}
269270

270271
/**
272+
* Retrieve email to friend url
273+
*
271274
* @param ModelProduct $product
272275
* @return string
273276
*/
@@ -282,6 +285,8 @@ public function getEmailToFriendUrl($product)
282285
}
283286

284287
/**
288+
* Get statuses
289+
*
285290
* @return array
286291
*/
287292
public function getStatuses()
@@ -476,6 +481,7 @@ public function initProduct($productId, $controller, $params = null)
476481

477482
/**
478483
* Prepares product options by buyRequest: retrieves values and assigns them as default.
484+
*
479485
* Also parses and adds product management related values - e.g. qty
480486
*
481487
* @param ModelProduct $product
@@ -493,6 +499,7 @@ public function prepareProductOptions($product, $buyRequest)
493499

494500
/**
495501
* Process $buyRequest and sets its options before saving configuration to some product item.
502+
*
496503
* This method is used to attach additional parameters to processed buyRequest.
497504
*
498505
* $params holds parameters of what operation must be performed:
@@ -541,8 +548,6 @@ public function addParamsToBuyRequest($buyRequest, $params)
541548
/**
542549
* Set flag that shows if Magento has to check product to be saleable (enabled and/or inStock)
543550
*
544-
* For instance, during order creation in the backend admin has ability to add any products to order
545-
*
546551
* @param bool $skipSaleableCheck
547552
* @return Product
548553
*/

app/code/Magento/Catalog/Plugin/Block/Topmenu.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
*/
1515
class Topmenu
1616
{
17+
/**
18+
* Cache tag for menu block
19+
*/
20+
private $cacheTag = "top_menu";
21+
1722
/**
1823
* Catalog category
1924
*
@@ -119,6 +124,7 @@ public function beforeGetIdentities(\Magento\Theme\Block\Html\Topmenu $subject)
119124
$subject->addIdentity(Category::CACHE_TAG);
120125
$rootId = $this->storeManager->getStore()->getRootCategoryId();
121126
$storeId = $this->storeManager->getStore()->getId();
127+
$currentCategory = $this->getCurrentCategory();
122128
/** @var \Magento\Catalog\Model\ResourceModel\Category\Collection $collection */
123129
$collection = $this->getCategoryTree($storeId, $rootId);
124130
$mapping = [$rootId => $subject->getMenu()]; // use nodes stack to avoid recursion
@@ -128,6 +134,9 @@ public function beforeGetIdentities(\Magento\Theme\Block\Html\Topmenu $subject)
128134
}
129135
$subject->addIdentity(Category::CACHE_TAG . '_' . $category->getId());
130136
}
137+
if ($currentCategory) {
138+
$subject->addIdentity($this->cacheTag . '_' . Category::CACHE_TAG . '_' . $currentCategory->getId());
139+
}
131140
}
132141

133142
/**

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@
4343
<selectOption selector="{{AdminProductFormNewAttributeSection.attributeType}}" userInput="{{attributeType}}" stepKey="selectAttributeType"/>
4444
<click selector="{{AdminProductFormNewAttributeSection.saveAttribute}}" stepKey="saveAttribute"/>
4545
</actionGroup>
46+
<actionGroup name="AdminCreateAttributeFromProductPageWithScope" extends="AdminCreateAttributeFromProductPage" insertAfter="selectAttributeType">
47+
<arguments>
48+
<argument name="scope" type="string" defaultValue="Store View"/>
49+
</arguments>
50+
<conditionalClick selector="{{AdminProductFormNewAttributeAdvancedSection.sectionHeader}}" dependentSelector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" visible="false" stepKey="openAttributeAdvancedSection"/>
51+
<selectOption selector="{{AdminProductFormNewAttributeAdvancedSection.scope}}" userInput="{{scope}}" stepKey="selectScope"/>
52+
</actionGroup>
4653

4754
<actionGroup name="AdminCreateAttributeWithValueWithTwoStoreViesFromProductPage" extends="AdminCreateAttributeFromProductPage">
4855
<remove keyForRemoval="saveAttribute"/>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
<element name="expandAll" type="button" selector=".tree-actions a:last-child"/>
1414
<element name="categoryTreeRoot" type="text" selector="div.x-tree-root-node>li.x-tree-node:first-of-type>div.x-tree-node-el:first-of-type" timeout="30"/>
1515
<element name="categoryInTree" type="text" selector="//a/span[contains(text(), '{{name}}')]" parameterized="true" timeout="30"/>
16+
<element name="categoryHighlighted" type="text" selector="//ul[@id='ui-id-2']//li//a/span[contains(text(),'{{name}}')]/../.." parameterized="true" timeout="30"/>
17+
<element name="categoryNotHighlighted" type="text" selector="ul[id=\'ui-id-2\'] li[class~=\'active\']" timeout="30"/>
1618
<element name="categoryInTreeUnderRoot" type="text" selector="//li/ul/li[@class='x-tree-node']/div/a/span[contains(text(), '{{name}}')]" parameterized="true"/>
1719
<element name="lastCreatedCategory" type="block" selector=".x-tree-root-ct li li:last-child" />
1820
<element name="treeContainer" type="block" selector=".tree-holder" />

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<section name="AdminProductFormNewAttributeAdvancedSection">
2626
<element name="sectionHeader" type="button" selector="div[data-index='advanced_fieldset']"/>
2727
<element name="defaultValue" type="textarea" selector="input[name='default_value_text']"/>
28+
<element name="scope" type="select" selector="//div[@data-index='advanced_fieldset']//select[@name='is_global']"/>
2829
</section>
2930
<section name="AdminProductFormNewAttributeStorefrontSection">
3031
<element name="sectionHeader" type="button" selector="div[data-index='front_fieldset']"/>
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="CheckCurrentCategoryIsHighlightedAndProductsDisplayed">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<title value="Сheck that current category is highlighted and all products displayed for it"/>
15+
<description value="Сheck that current category is highlighted and all products displayed for it"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-99028"/>
18+
<useCaseId value="MAGETWO-98748"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<createData entity="SimpleSubCategory" stepKey="category1"/>
24+
<createData entity="SimpleSubCategory" stepKey="category2"/>
25+
<createData entity="SimpleSubCategory" stepKey="category3"/>
26+
<createData entity="SimpleSubCategory" stepKey="category4"/>
27+
<createData entity="SimpleProduct" stepKey="product1">
28+
<requiredEntity createDataKey="category1"/>
29+
</createData>
30+
<createData entity="SimpleProduct" stepKey="product2">
31+
<requiredEntity createDataKey="category1"/>
32+
</createData>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="product1" stepKey="deleteProduct1"/>
36+
<deleteData createDataKey="product2" stepKey="deleteProduct2"/>
37+
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
38+
<deleteData createDataKey="category2" stepKey="deleteCategory2"/>
39+
<deleteData createDataKey="category3" stepKey="deleteCategory3"/>
40+
<deleteData createDataKey="category4" stepKey="deleteCategory4"/>
41+
<actionGroup ref="logout" stepKey="logout"/>
42+
</after>
43+
<!--Open Storefront home page-->
44+
<comment userInput="Open Storefront home page" stepKey="openStorefrontHomePage"/>
45+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontHomePage"/>
46+
<waitForPageLoad stepKey="waitForSimpleProductPage"/>
47+
<!--Click on first category-->
48+
<comment userInput="Click on first category" stepKey="openFirstCategoryPage"/>
49+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$category1.name$$)}}" stepKey="clickCategory1Name"/>
50+
<waitForPageLoad stepKey="waitForCategory1Page"/>
51+
<!--Check if current category is highlighted and the others are not-->
52+
<comment userInput="Check if current category is highlighted and the others are not" stepKey="checkCateg1NameIsHighlighted"/>
53+
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category1.name$$)}}" userInput="class" stepKey="grabCategory1Class"/>
54+
<assertContains expectedType="string" expected="active" actual="$grabCategory1Class" stepKey="assertCategory1IsHighlighted"/>
55+
<executeJS function="return document.querySelectorAll('{{AdminCategorySidebarTreeSection.categoryNotHighlighted}}').length" stepKey="highlightedAmount"/>
56+
<assertEquals expectedType="int" expected="1" actual="$highlightedAmount" stepKey="assertRestCategories1IsNotHighlighted"/>
57+
<!--See products in the category page-->
58+
<comment userInput="See products in the category page" stepKey="seeProductsInCategoryPage"/>
59+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($product1.name$)}}" stepKey="seeProduct1InCategoryPage"/>
60+
<seeElement selector="{{StorefrontCategoryMainSection.specifiedProductItemInfo($product2.name$)}}" stepKey="seeProduct2InCategoryPage"/>
61+
<!--Click on second category-->
62+
<comment userInput="Click on second category" stepKey="openSecondCategoryPage"/>
63+
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$category2.name$$)}}" stepKey="clickCategory2Name"/>
64+
<waitForPageLoad stepKey="waitForCategory2Page"/>
65+
<!--Check if current category is highlighted and the others are not-->
66+
<comment userInput="Check if current category is highlighted and the others are not" stepKey="checkCateg2NameIsHighlighted"/>
67+
<grabAttributeFrom selector="{{AdminCategorySidebarTreeSection.categoryHighlighted($$category2.name$$)}}" userInput="class" stepKey="grabCategory2Class"/>
68+
<assertContains expectedType="string" expected="active" actual="$grabCategory2Class" stepKey="assertCategory2IsHighlighted"/>
69+
<executeJS function="return document.querySelectorAll('{{AdminCategorySidebarTreeSection.categoryNotHighlighted}}').length" stepKey="highlightedAmount2"/>
70+
<assertEquals expectedType="int" expected="1" actual="$highlightedAmount2" stepKey="assertRestCategories1IsNotHighlighted2"/>
71+
</test>
72+
</tests>

app/code/Magento/Cms/Test/Mftf/ActionGroup/ClearWidgetsFromCMSContentActionGroup.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,13 @@
2121
<waitForPageLoad stepKey="waitSaveToBeApplied"/>
2222
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the page." stepKey="seeSaveSuccess"/>
2323
</actionGroup>
24+
<actionGroup name="ClearWidgetsForCMSHomePageContentWYSIWYGDisabled">
25+
<amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/>
26+
<waitForPageLoad stepKey="waitForCmsPageEditPage"/>
27+
<conditionalClick selector="{{CmsNewPagePageActionsSection.contentSectionName}}" dependentSelector="{{CatalogWidgetSection.insertWidgetButton}}" visible="false" stepKey="clickShowHideEditorIfVisible"/>
28+
<waitForElementVisible selector="{{CmsNewPagePageContentSection.content}}" stepKey="waitForContentField"/>
29+
<fillField selector="{{CmsNewPagePageContentSection.content}}" userInput="CMS homepage content goes here." stepKey="resetCMSPageToDefaultContent"/>
30+
<click selector="{{CmsNewPagePageActionsSection.saveAndContinueEdit}}" stepKey="clickSave"/>
31+
<waitForPageLoad stepKey="waitForSettingsApply"/>
32+
</actionGroup>
2433
</actionGroups>

app/code/Magento/ConfigurableProduct/Model/Product/VariationHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\ConfigurableProduct\Model\Product;
89

@@ -201,12 +202,11 @@ protected function fillSimpleProductData(
201202

202203
$keysFilter = ['item_id', 'product_id', 'stock_id', 'type_id', 'website_id'];
203204
$postData['stock_data'] = array_diff_key((array)$parentProduct->getStockData(), array_flip($keysFilter));
204-
if (!isset($postData['stock_data']['is_in_stock'])) {
205-
$stockStatus = $parentProduct->getQuantityAndStockStatus();
206-
if (isset($stockStatus['is_in_stock'])) {
207-
$postData['stock_data']['is_in_stock'] = $stockStatus['is_in_stock'];
208-
}
205+
$stockStatus = $parentProduct->getQuantityAndStockStatus();
206+
if (isset($stockStatus['is_in_stock'])) {
207+
$postData['stock_data']['is_in_stock'] = $stockStatus['is_in_stock'];
209208
}
209+
210210
$postData = $this->processMediaGallery($product, $postData);
211211
$postData['status'] = isset($postData['status'])
212212
? $postData['status']

app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductActionGroup.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,25 @@
122122
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
123123
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
124124
</actionGroup>
125+
<actionGroup name="createOptionsForAttribute">
126+
<arguments>
127+
<argument name="attributeName" type="string" defaultValue="{{productAttributeColor.default_label}}"/>
128+
<argument name="firstOptionName" type="string" defaultValue="option1"/>
129+
<argument name="secondOptionName" type="string" defaultValue="option2"/>
130+
</arguments>
131+
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickOnFilters"/>
132+
<fillField userInput="{{attributeName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" stepKey="fillFilterAttributeCodeField"/>
133+
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>
134+
<click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/>
135+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/>
136+
<click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateFirstNewValue"/>
137+
<fillField userInput="{{firstOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewFirstOption"/>
138+
<click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveNewAttribute"/>
139+
<click selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="clickOnCreateSecondNewValue"/>
140+
<fillField userInput="{{secondOptionName}}" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" stepKey="fillFieldForNewSecondOption"/>
141+
<click selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
142+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/>
143+
</actionGroup>
125144

126145
<actionGroup name="createConfigurationsForAttribute" extends="generateConfigurationsByAttributeCode">
127146
<arguments>
@@ -282,6 +301,16 @@
282301
<selectOption userInput="{{frontend_label}}" selector="{{AdminCreateProductConfigurationsPanel.selectPriceButton}}" stepKey="selectOption"/>
283302
<fillField selector="{{AdminCreateProductConfigurationsPanel.price(label)}}" userInput="{{price}}" stepKey="enterAttributeQuantity"/>
284303
</actionGroup>
304+
<actionGroup name="addUniqueQuantityToConfigurableProductOption">
305+
<arguments>
306+
<argument name="frontend_label" type="string" defaultValue="{{productAttributeColor.default_label}}"/>
307+
<argument name="label" type="string" defaultValue="option1"/>
308+
<argument name="quantity" type="string" defaultValue="10"/>
309+
</arguments>
310+
<click selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantityToEachSkus}}" stepKey="clickOnApplyUniqueQuantitiesToEachSku"/>
311+
<selectOption selector="{{AdminCreateProductConfigurationsPanel.selectQuantity}}" userInput="{{frontend_label}}" stepKey="selectOption"/>
312+
<fillField selector="{{AdminCreateProductConfigurationsPanel.applyUniqueQuantity(label)}}" userInput="{{quantity}}" stepKey="enterAttributeQuantity"/>
313+
</actionGroup>
285314

286315
<actionGroup name="saveConfigurableProductWithNewAttributeSet">
287316
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveConfigurableProduct"/>
@@ -318,4 +347,12 @@
318347
<waitForPageLoad stepKey="waitForNextStepLoaded"/>
319348
<see userInput="{{title}}" selector="{{AdminProductFormConfigurationsSection.stepsWizardTitle}}" stepKey="seeStepTitle"/>
320349
</actionGroup>
350+
<actionGroup name="AdminConfigurableProductDisableConfigurationsActionGroup">
351+
<arguments>
352+
<argument name="productName" type="string" defaultValue="{{SimpleProduct.name}}"/>
353+
</arguments>
354+
<click selector="{{AdminProductFormConfigurationsSection.actionsBtnByProductName(productName)}}" stepKey="clickToExpandActionsSelect"/>
355+
<click selector="{{AdminProductFormConfigurationsSection.disableProductBtn}}" stepKey="clickDisableChildProduct"/>
356+
<see selector="{{AdminProductFormConfigurationsSection.confProductOptionStatusCell(productName)}}" userInput="Disabled" stepKey="seeConfigDisabled"/>
357+
</actionGroup>
321358
</actionGroups>

0 commit comments

Comments
 (0)