Skip to content

Commit 1d7b0c9

Browse files
author
Mariana Lashch
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into port-94472
2 parents d1d3a3c + 7d6b0d7 commit 1d7b0c9

File tree

50 files changed

+1075
-198
lines changed

Some content is hidden

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

50 files changed

+1075
-198
lines changed

app/code/Magento/Backend/Block/Widget/Form.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ protected function _construct()
5959
parent::_construct();
6060

6161
$this->setDestElementId('edit_form');
62-
$this->setShowGlobalIcon(false);
6362
}
6463

6564
/**

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @api
1313
* @deprecated 100.2.0 in favour of UI component implementation
1414
* @method string getRowClickCallback() getRowClickCallback()
15-
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback() setRowClickCallback(string $value)
15+
* @method \Magento\Backend\Block\Widget\Grid setRowClickCallback(string $value)
1616
* @SuppressWarnings(PHPMD.TooManyFields)
1717
* @since 100.0.2
1818
*/
@@ -150,7 +150,10 @@ public function __construct(
150150
}
151151

152152
/**
153+
* Internal constructor, that is called from real constructor
154+
*
153155
* @return void
156+
*
154157
* @SuppressWarnings(PHPMD.NPathComplexity)
155158
*/
156159
protected function _construct()
@@ -709,6 +712,7 @@ public function getGridUrl()
709712

710713
/**
711714
* Grid url getter
715+
*
712716
* Version of getGridUrl() but with parameters
713717
*
714718
* @param array $params url parameters

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Attributes.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ public function __construct(
6464
parent::__construct($context, $registry, $formFactory, $data);
6565
}
6666

67-
/**
68-
* Construct block
69-
*
70-
* @return void
71-
*/
72-
protected function _construct()
73-
{
74-
parent::_construct();
75-
$this->setShowGlobalIcon(true);
76-
}
77-
7867
/**
7968
* Prepares form
8069
*

app/code/Magento/Catalog/Block/Product/ProductList/Crosssell.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*/
1010
namespace Magento\Catalog\Block\Product\ProductList;
1111

12+
/**
13+
* Crosssell block for product
14+
*/
1215
class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
1316
{
1417
/**
@@ -25,7 +28,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct
2528
*/
2629
protected function _prepareData()
2730
{
28-
$product = $this->_coreRegistry->registry('product');
31+
$product = $this->getProduct();
2932
/* @var $product \Magento\Catalog\Model\Product */
3033

3134
$this->_itemCollection = $product->getCrossSellProductCollection()->addAttributeToSelect(
@@ -43,6 +46,7 @@ protected function _prepareData()
4346

4447
/**
4548
* Before rendering html process
49+
*
4650
* Prepare items collection
4751
*
4852
* @return \Magento\Catalog\Block\Product\ProductList\Crosssell

app/code/Magento/Catalog/Block/Product/ProductList/Related.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ public function __construct(
7777
}
7878

7979
/**
80+
* Prepare data
81+
*
8082
* @return $this
8183
*/
8284
protected function _prepareData()
8385
{
84-
$product = $this->_coreRegistry->registry('product');
86+
$product = $this->getProduct();
8587
/* @var $product \Magento\Catalog\Model\Product */
8688

8789
$this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect(
@@ -103,6 +105,8 @@ protected function _prepareData()
103105
}
104106

105107
/**
108+
* Before to html handler
109+
*
106110
* @return $this
107111
*/
108112
protected function _beforeToHtml()
@@ -112,6 +116,8 @@ protected function _beforeToHtml()
112116
}
113117

114118
/**
119+
* Get collection items
120+
*
115121
* @return Collection
116122
*/
117123
public function getItems()

app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ public function __construct(
9191
}
9292

9393
/**
94+
* Prepare data
95+
*
9496
* @return $this
9597
*/
9698
protected function _prepareData()
9799
{
98-
$product = $this->_coreRegistry->registry('product');
100+
$product = $this->getProduct();
99101
/* @var $product \Magento\Catalog\Model\Product */
100102
$this->_itemCollection = $product->getUpSellProductCollection()->setPositionOrder()->addStoreFilter();
101103
if ($this->moduleManager->isEnabled('Magento_Checkout')) {
@@ -121,6 +123,8 @@ protected function _prepareData()
121123
}
122124

123125
/**
126+
* Before to html handler
127+
*
124128
* @return $this
125129
*/
126130
protected function _beforeToHtml()
@@ -130,6 +134,8 @@ protected function _beforeToHtml()
130134
}
131135

132136
/**
137+
* Get items collection
138+
*
133139
* @return Collection
134140
*/
135141
public function getItemCollection()
@@ -145,6 +151,8 @@ public function getItemCollection()
145151
}
146152

147153
/**
154+
* Get collection items
155+
*
148156
* @return \Magento\Framework\DataObject[]
149157
*/
150158
public function getItems()
@@ -156,6 +164,8 @@ public function getItems()
156164
}
157165

158166
/**
167+
* Get row count
168+
*
159169
* @return float
160170
*/
161171
public function getRowCount()
@@ -164,6 +174,8 @@ public function getRowCount()
164174
}
165175

166176
/**
177+
* Set column count
178+
*
167179
* @param string $columns
168180
* @return $this
169181
*/
@@ -176,6 +188,8 @@ public function setColumnCount($columns)
176188
}
177189

178190
/**
191+
* Get column count
192+
*
179193
* @return int
180194
*/
181195
public function getColumnCount()
@@ -184,6 +198,8 @@ public function getColumnCount()
184198
}
185199

186200
/**
201+
* Reset items iterator
202+
*
187203
* @return void
188204
*/
189205
public function resetItemsIterator()
@@ -193,6 +209,8 @@ public function resetItemsIterator()
193209
}
194210

195211
/**
212+
* Get iterable item
213+
*
196214
* @return mixed
197215
*/
198216
public function getIterableItem()
@@ -204,6 +222,7 @@ public function getIterableItem()
204222

205223
/**
206224
* Set how many items we need to show in upsell block
225+
*
207226
* Notice: this parameter will be also applied
208227
*
209228
* @param string $type
@@ -219,6 +238,8 @@ public function setItemLimit($type, $limit)
219238
}
220239

221240
/**
241+
* Get item limit
242+
*
222243
* @param string $type
223244
* @return array|int
224245
*/

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,28 @@
213213
<conditionalClick selector="{{AdminProductGridTableHeaderSection.id('descend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('ascend')}}" visible="false" stepKey="sortById"/>
214214
<waitForPageLoad stepKey="waitForPageLoad"/>
215215
</actionGroup>
216+
217+
<!--Disabled a product by filtering grid and using change status action-->
218+
<actionGroup name="ChangeStatusProductUsingProductGridActionGroup">
219+
<arguments>
220+
<argument name="product"/>
221+
<argument name="status" defaultValue="Enable" type="string" />
222+
</arguments>
223+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
224+
<waitForPageLoad time="60" stepKey="waitForPageLoadInitial"/>
225+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
226+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
227+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{product.sku}}" stepKey="fillProductSkuFilter"/>
228+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
229+
<see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{product.sku}}" stepKey="seeProductSkuInGrid"/>
230+
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
231+
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>
232+
233+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
234+
<click selector="{{AdminProductGridSection.bulkActionOption('Change status')}}" stepKey="clickChangeStatusAction"/>
235+
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled" parameterized="true"/>
236+
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
237+
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
238+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
239+
</actionGroup>
216240
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
<element name="productGridNameProduct" type="input" selector="//tbody//tr//td//div[contains(., '{{var1}}')]" parameterized="true" timeout="30"/>
3131
<element name="productGridContentsOnRow" type="checkbox" selector="//*[@id='container']//tr[{{row}}]/td" parameterized="true"/>
3232
<element name="selectRowBasedOnName" type="input" selector="//td/div[text()='{{var1}}']" parameterized="true"/>
33+
<element name="changeStatus" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-menu-item')]//ul/li/span[text() = '{{status}}']" parameterized="true"/>
3334
</section>
3435
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/TieredPricingAndQuantityIncrementsWorkWithDecimalinventoryTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
<!--Step5. Open *Advanced Inventory* pop-up. Set *Enable Qty Increments* to *Yes*. Fill *.5* in *Qty Increments*-->
6161
<click selector="{{AdminProductFormSection.advancedInventoryLink}}" stepKey="clickOnAdvancedInventoryLink2"/>
62+
<waitForPageLoad stepKey="waitForPageLoad"/>
6263
<scrollTo selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="scrollToEnableQtyIncrements"/>
6364
<click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrementsUseConfigSettings}}" stepKey="clickOnEnableQtyIncrementsUseConfigSettingsCheckbox"/>
6465
<click selector="{{AdminProductFormAdvancedInventorySection.enableQtyIncrements}}" stepKey="clickOnEnableQtyIncrements"/>

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

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,16 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
132132
*/
133133
const COL_NAME = 'name';
134134

135+
/**
136+
* Column new_from_date.
137+
*/
138+
const COL_NEW_FROM_DATE = 'new_from_date';
139+
140+
/**
141+
* Column new_to_date.
142+
*/
143+
const COL_NEW_TO_DATE = 'new_to_date';
144+
135145
/**
136146
* Column product website.
137147
*/
@@ -298,6 +308,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
298308
ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid',
299309
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Url key: \'%s\' was already generated for an item with the SKU: \'%s\'. You need to specify the unique URL key manually',
300310
ValidatorInterface::ERROR_DUPLICATE_MULTISELECT_VALUES => "Value for multiselect attribute %s contains duplicated values",
311+
ValidatorInterface::ERROR_NEW_TO_DATE => 'Make sure new_to_date is later than or the same as new_from_date',
301312
];
302313
//@codingStandardsIgnoreEnd
303314

@@ -319,8 +330,8 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
319330
Product::COL_TYPE => 'product_type',
320331
Product::COL_PRODUCT_WEBSITES => 'product_websites',
321332
'status' => 'product_online',
322-
'news_from_date' => 'new_from_date',
323-
'news_to_date' => 'new_to_date',
333+
'news_from_date' => self::COL_NEW_FROM_DATE,
334+
'news_to_date' => self::COL_NEW_TO_DATE,
324335
'options_container' => 'display_product_options_in',
325336
'minimal_price' => 'map_price',
326337
'msrp' => 'msrp_price',
@@ -2549,6 +2560,20 @@ public function validateRow(array $rowData, $rowNum)
25492560
}
25502561
}
25512562
}
2563+
2564+
if (!empty($rowData[self::COL_NEW_FROM_DATE]) && !empty($rowData[self::COL_NEW_TO_DATE])
2565+
) {
2566+
$newFromTimestamp = strtotime($this->dateTime->formatDate($rowData[self::COL_NEW_FROM_DATE], false));
2567+
$newToTimestamp = strtotime($this->dateTime->formatDate($rowData[self::COL_NEW_TO_DATE], false));
2568+
if ($newFromTimestamp > $newToTimestamp) {
2569+
$this->addRowError(
2570+
ValidatorInterface::ERROR_NEW_TO_DATE,
2571+
$rowNum,
2572+
$rowData[self::COL_NEW_TO_DATE]
2573+
);
2574+
}
2575+
}
2576+
25522577
return !$this->getErrorAggregator()->isRowInvalid($rowNum);
25532578
}
25542579

0 commit comments

Comments
 (0)