Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 11f66c4

Browse files
author
Alexander Akimov
authored
Merge pull request #3259 from magento-tsg/2.2-develop-pr49
[TSG] Backporting for 2.2 (pr49) (2.2.8)
2 parents c34ced3 + 4c1e0a4 commit 11f66c4

File tree

42 files changed

+1239
-190
lines changed

Some content is hidden

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

42 files changed

+1239
-190
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ protected function _construct()
151151
*/
152152
public function _afterLoad()
153153
{
154-
parent::_afterLoad();
155-
if ($this->getStoreId() && $this->_items) {
156-
foreach ($this->_items as $item) {
157-
$item->setStoreId($this->getStoreId());
158-
}
159-
}
160-
return $this;
154+
return parent::_afterLoad();
161155
}
162156

163157
/**
@@ -356,7 +350,10 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
356350
}
357351

358352
/**
353+
* Get Catalog Rule Processor.
354+
*
359355
* @return \Magento\CatalogRule\Model\ResourceModel\Product\CollectionProcessor
356+
*
360357
* @deprecated 100.2.0
361358
*/
362359
private function getCatalogRuleProcessor()

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,7 @@ public function getFlatState()
476476
}
477477

478478
/**
479-
* Retrieve is flat enabled flag
480-
* Return always false if magento run admin
479+
* Retrieve is flat enabled. Return always false if magento run admin.
481480
*
482481
* @return bool
483482
*/
@@ -505,8 +504,7 @@ protected function _construct()
505504
}
506505

507506
/**
508-
* Standard resource collection initialization
509-
* Needed for child classes
507+
* Standard resource collection initialization. Needed for child classes.
510508
*
511509
* @param string $model
512510
* @param string $entityModel
@@ -545,8 +543,7 @@ protected function _prepareStaticFields()
545543
}
546544

547545
/**
548-
* Retrieve collection empty item
549-
* Redeclared for specifying id field name without getting resource model inside model
546+
* Get collection empty item. Redeclared for specifying id field name without getting resource model inside model.
550547
*
551548
* @return \Magento\Framework\DataObject
552549
*/
@@ -632,8 +629,7 @@ public function _loadAttributes($printQuery = false, $logQuery = false)
632629
}
633630

634631
/**
635-
* Add attribute to entities in collection
636-
* If $attribute=='*' select all attributes
632+
* Add attribute to entities in collection. If $attribute=='*' select all attributes.
637633
*
638634
* @param array|string|integer|\Magento\Framework\App\Config\Element $attribute
639635
* @param bool|string $joinType
@@ -669,8 +665,7 @@ public function addAttributeToSelect($attribute, $joinType = false)
669665
}
670666

671667
/**
672-
* Processing collection items after loading
673-
* Adding url rewrites, minimal prices, final prices, tax percents
668+
* Processing collection items after loading. Adding url rewrites, minimal prices, final prices, tax percents.
674669
*
675670
* @return $this
676671
*/
@@ -681,6 +676,7 @@ protected function _afterLoad()
681676
}
682677

683678
$this->_prepareUrlDataObject();
679+
$this->prepareStoreId();
684680

685681
if (count($this)) {
686682
$this->_eventManager->dispatch('catalog_product_collection_load_after', ['collection' => $this]);
@@ -689,6 +685,23 @@ protected function _afterLoad()
689685
return $this;
690686
}
691687

688+
/**
689+
* Add Store ID to products from collection.
690+
*
691+
* @return $this
692+
*/
693+
protected function prepareStoreId()
694+
{
695+
if ($this->getStoreId() !== null) {
696+
/** @var $item \Magento\Catalog\Model\Product */
697+
foreach ($this->_items as $item) {
698+
$item->setStoreId($this->getStoreId());
699+
}
700+
}
701+
702+
return $this;
703+
}
704+
692705
/**
693706
* Prepare Url Data object
694707
*
@@ -755,8 +768,7 @@ public function addIdFilter($productId, $exclude = false)
755768
}
756769

757770
/**
758-
* Adding product website names to result collection
759-
* Add for each product websites information
771+
* Adding product website names to result collection. Add for each product websites information.
760772
*
761773
* @return $this
762774
*/
@@ -767,7 +779,7 @@ public function addWebsiteNamesToResult()
767779
}
768780

769781
/**
770-
* {@inheritdoc}
782+
* @inheritdoc
771783
*/
772784
public function load($printQuery = false, $logQuery = false)
773785
{
@@ -825,8 +837,7 @@ protected function doAddWebsiteNamesToResult()
825837
}
826838

827839
/**
828-
* Add store availability filter. Include availability product
829-
* for store website
840+
* Add store availability filter. Include availability product for store website.
830841
*
831842
* @param null|string|bool|int|Store $store
832843
* @return $this
@@ -1115,7 +1126,7 @@ public function getSelectCountSql()
11151126
/**
11161127
* Get SQL for get record count
11171128
*
1118-
* @param null $select
1129+
* @param \Magento\Framework\DB\Select $select
11191130
* @param bool $resetLeftJoins
11201131
* @return \Magento\Framework\DB\Select
11211132
*/
@@ -1357,8 +1368,7 @@ public function joinUrlRewrite()
13571368
}
13581369

13591370
/**
1360-
* Add URL rewrites data to product
1361-
* If collection loadded - run processing else set flag
1371+
* Add URL rewrites data to product. If collection loadded - run processing else set flag.
13621372
*
13631373
* @param int|string $categoryId
13641374
* @return $this
@@ -1581,7 +1591,8 @@ public function addAttributeToFilter($attribute, $condition = null, $joinType =
15811591
}
15821592

15831593
/**
1584-
* {@inheritdoc}
1594+
* @inheritdoc
1595+
*
15851596
* @since 101.0.0
15861597
*/
15871598
protected function getEntityPkName(\Magento\Eav\Model\Entity\AbstractEntity $entity)
@@ -2343,7 +2354,10 @@ private function getGalleryReadHandler()
23432354
}
23442355

23452356
/**
2357+
* Retrieve Media gallery resource.
2358+
*
23462359
* @deprecated 101.0.1
2360+
*
23472361
* @return \Magento\Catalog\Model\ResourceModel\Product\Gallery
23482362
*/
23492363
private function getMediaGalleryResource()

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,54 @@
9090
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDone"/>
9191
<waitForElementNotVisible selector="{{AdminProductFormAdvancedPricingSection.specialPrice}}" stepKey="waitForCloseModalWindow"/>
9292
</actionGroup>
93+
94+
<actionGroup name="ProductSetWebsite">
95+
<arguments>
96+
<argument name="website"/>
97+
</arguments>
98+
<scrollTo selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="scrollToWebsites"/>
99+
<click selector="{{ProductInWebsitesSection.sectionHeader}}" stepKey="clickToOpenProductInWebsite"/>
100+
<waitForPageLoad stepKey="waitForPageOpened"/>
101+
<click selector="{{ProductInWebsitesSection.website(website.name)}}" stepKey="selectWebsite"/>
102+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
103+
<waitForPageLoad time='60' stepKey="waitForPageOpened1"/>
104+
</actionGroup>
105+
106+
<actionGroup name="ProductSetAdvancedPricing">
107+
<arguments>
108+
<argument name="website"/>
109+
<argument name="group" type="string" defaultValue="Retailer"/>
110+
<argument name="quantity" type="string" defaultValue="1"/>
111+
<argument name="price" type="string" defaultValue="Discount"/>
112+
<argument name="amount" type="string" defaultValue="45"/>
113+
</arguments>
114+
<scrollToTopOfPage stepKey="scrollToTopOfThePagePreventHeaderOverlap"/>
115+
<click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/>
116+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/>
117+
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAnd10percent"/>
118+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" stepKey="waitForSelectCustomerGroupNameAttribute"/>
119+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceWebsiteSelect('0')}}" userInput="{{website.name}}" stepKey="selectProductWebsiteValue"/>
120+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceCustGroupSelect('0')}}" userInput="{{group}}" stepKey="selectProductCustomGroupValue"/>
121+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="{{quantity}}" stepKey="fillProductTierPriceQtyInput"/>
122+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="{{price}}" stepKey="selectProductTierPriceValueType"/>
123+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="{{amount}}" stepKey="selectProductTierPricePriceInput"/>
124+
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/>
125+
<waitForPageLoad stepKey="waitForProductSave"/>
126+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSaveProduct"/>
127+
<waitForPageLoad time="60" stepKey="waitForProductSave1"/>
128+
<see userInput="You saved the product." stepKey="seeSaveConfirmation"/>
129+
</actionGroup>
130+
131+
<!--Switch to New Store view-->
132+
<actionGroup name="SwitchToTheNewStoreView">
133+
<arguments>
134+
<argument name="storeViewName" type="string"/>
135+
</arguments>
136+
<scrollTo selector="{{AdminProductContentSection.pageHeader}}" stepKey="scrollToUp"/>
137+
<waitForElementVisible selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="waitForElementBecomeVisible"/>
138+
<click selector="{{AdminProductFormActionSection.changeStoreButton}}" stepKey="clickStoreviewSwitcher"/>
139+
<click selector="{{AdminProductFormActionSection.selectStoreView(storeViewName)}}" stepKey="chooseStoreView"/>
140+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="acceptStoreSwitchingMessage"/>
141+
<waitForPageLoad stepKey="waitForPageLoad"/>
142+
</actionGroup>
93143
</actionGroups>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<argument name="product" defaultValue="product"/>
1414
</arguments>
1515
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
16-
<waitForPageLoad time="30" stepKey="waitForProductsPageToLoad"/>
16+
<waitForPageLoad time="60" stepKey="waitForProductsPageToLoad"/>
1717
<click stepKey="openFiltersSectionOnProductsPage" selector="{{AdminProductFiltersSection.FiltersButton}}"/>
1818
<conditionalClick selector="{{AdminProductFiltersSection.clearFiltersButton}}" dependentSelector="{{AdminProductFiltersSection.clearFiltersButton}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
1919
<fillField stepKey="fillSkuFieldOnFiltersSection" userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.SkuInput}}"/>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CatalogPriceScopeWebsite" type="catalog_price_config_state">
12+
<requiredEntity type="scope">ScopeWebsite</requiredEntity>
13+
<requiredEntity type="default_product_price">DefaultProductPrice</requiredEntity>
14+
</entity>
15+
<entity name="ScopeWebsite" type="scope">
16+
<data key="value">1</data>
17+
</entity>
18+
<entity name="DefaultProductPrice" type="default_product_price">
19+
<data key="value">0</data>
20+
</entity>
21+
<entity name="DefaultConfigCatalogPrice" type="catalog_price_config_state">
22+
<requiredEntity type="scope">ScopeGlobal</requiredEntity>
23+
<requiredEntity type="default_product_price">DefaultProductPrice</requiredEntity>
24+
</entity>
25+
<entity name="ScopeGlobal" type="scope">
26+
<data key="value">0</data>
27+
</entity>
28+
<entity name="DefaultProductPrice" type="default_product_price">
29+
<data key="value"/>
30+
</entity>
31+
</entities>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="TestDataTierPrice" type="data">
12+
<data key="goldenPrice1">$676.50</data>
13+
<data key="goldenPrice2">$615.00</data>
14+
</entity>
15+
</entities>
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+
<operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/DataGenerator/etc/dataOperation.xsd">
10+
<operation name="CatalogPriceConfigState" dataType="catalog_price_config_state" type="create" auth="adminFormKey" url="/admin/system_config/save/section/catalog/" method="POST" successRegex="/messages-message-success/">
11+
<object key="groups" dataType="catalog_price_config_state">
12+
<object key="price" dataType="catalog_price_config_state">
13+
<object key="fields" dataType="catalog_price_config_state">
14+
<object key="scope" dataType="scope">
15+
<field key="value">string</field>
16+
</object>
17+
<object key="default_product_price" dataType="default_product_price">
18+
<field key="value">string</field>
19+
</object>
20+
</object>
21+
</object>
22+
</object>
23+
</operation>
24+
</operations>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@
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="save" type="button" selector="#save-button"/>
2423
</section>
2524
</sections>

0 commit comments

Comments
 (0)