Skip to content

Commit 0b8f709

Browse files
committed
MC-41284: Catalog product grid filter works incorrectly
1 parent 7c6b636 commit 0b8f709

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,14 @@
448448
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
449449
</field>
450450
</group>
451+
<group id="grid" translate="grid" type="text" sortOrder="45" showInDefault="1">
452+
<label>Admin Grids</label>
453+
<field id="show_approximate_products_amount_grid" translate="label"
454+
type="select" sortOrder="1" showInDefault="1" canRestore="1">
455+
<label>Show approximate products amount in a product grid</label>
456+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
457+
</field>
458+
</group>
451459
</section>
452460
<section id="web" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
453461
<label>Web</label>

app/code/Magento/Backend/etc/config.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<max_height>1200</max_height>
3232
</upload_configuration>
3333
</system>
34+
<admin>
35+
<grid>
36+
<show_approximate_products_amount_grid>0</show_approximate_products_amount_grid>
37+
</grid>
38+
</admin>
3439
<general>
3540
<validator_data>
3641
<input_types>

app/code/Magento/Catalog/Ui/DataProvider/Product/ProductCollection.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ protected function _productLimitationJoinPrice()
3333
*/
3434
public function getSize()
3535
{
36-
$sql = $this->getSelectCountSql();
37-
$possibleCount = $this->analyzeCount($sql);
38-
39-
if ($possibleCount > 20000) {
40-
return $possibleCount;
36+
if ((bool)$this->_scopeConfig->getValue('admin/grid/show_approximate_products_amount_grid')) {
37+
$sql = $this->getSelectCountSql();
38+
return $this->analyzeCount($sql);
4139
}
4240

4341
return parent::getSize();

0 commit comments

Comments
 (0)