Skip to content

Commit 0cbd858

Browse files
committed
MC-30522: Unexpected behavior of “Manage Shopping Cart” regarding "Products in the Comparison List" and "Recently Compared Products”
1 parent 0ec56d8 commit 0cbd858

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Magento\Framework\App\Filesystem\DirectoryList;
99

1010
/**
11+
* Extended Grid Widget
12+
*
1113
* @api
1214
* @deprecated 100.2.0 in favour of UI component implementation
1315
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -177,7 +179,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba
177179
protected $_path = 'export';
178180

179181
/**
182+
* Initialization
183+
*
180184
* @return void
185+
* @throws \Magento\Framework\Exception\FileSystemException
181186
*/
182187
protected function _construct()
183188
{
@@ -297,6 +302,7 @@ public function addColumn($columnId, $column)
297302
);
298303
$this->getColumnSet()->getChildBlock($columnId)->setGrid($this);
299304
} else {
305+
// phpcs:ignore Magento2.Exceptions.DirectThrow
300306
throw new \Exception(__('Please correct the column format and try again.'));
301307
}
302308

@@ -471,12 +477,6 @@ protected function _prepareMassactionColumn()
471477
protected function _prepareCollection()
472478
{
473479
if ($this->getCollection()) {
474-
/*
475-
if ($this->getCollection()->isLoaded()) {
476-
$this->getCollection()->clear();
477-
}
478-
*/
479-
480480
parent::_prepareCollection();
481481

482482
if (!$this->_isExport) {
@@ -665,6 +665,7 @@ public function setEmptyCellLabel($label)
665665
*/
666666
public function getRowUrl($item)
667667
{
668+
// phpstan:ignore "Call to an undefined static method"
668669
$res = parent::getRowUrl($item);
669670
return $res ? $res : '#';
670671
}
@@ -682,6 +683,7 @@ public function getMultipleRows($item)
682683

683684
/**
684685
* Retrieve columns for multiple rows
686+
*
685687
* @return array
686688
*/
687689
public function getMultipleRowColumns()
@@ -945,6 +947,7 @@ protected function _getExportTotals()
945947

946948
/**
947949
* Iterate collection and call callback method per item
950+
*
948951
* For callback method first argument always is item object
949952
*
950953
* @param string $callback
@@ -974,7 +977,12 @@ public function _exportIterateCollection($callback, array $args)
974977
$page++;
975978

976979
foreach ($collection as $item) {
977-
call_user_func_array([$this, $callback], array_merge([$item], $args));
980+
//phpcs:ignore Magento2.Functions.DiscouragedFunction
981+
call_user_func_array(
982+
[$this, $callback],
983+
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
984+
array_merge([$item], $args)
985+
);
978986
}
979987
}
980988
}
@@ -1011,6 +1019,7 @@ public function getCsvFile()
10111019
$this->_isExport = true;
10121020
$this->_prepareGrid();
10131021

1022+
// phpcs:ignore Magento2.Security.InsecureFunction
10141023
$name = md5(microtime());
10151024
$file = $this->_path . '/' . $name . '.csv';
10161025

@@ -1155,6 +1164,7 @@ public function getExcelFile($sheetName = '')
11551164
[$this, 'getRowRecord']
11561165
);
11571166

1167+
// phpcs:ignore Magento2.Security.InsecureFunction
11581168
$name = md5(microtime());
11591169
$file = $this->_path . '/' . $name . '.xml';
11601170

@@ -1246,7 +1256,7 @@ public function setCollection($collection)
12461256
}
12471257

12481258
/**
1249-
* get collection object
1259+
* Get collection object
12501260
*
12511261
* @return \Magento\Framework\Data\Collection
12521262
*/

0 commit comments

Comments
 (0)