Skip to content

Commit 9400ece

Browse files
committed
MC-41284: Catalog product grid filter works incorrectly
1 parent 3978f42 commit 9400ece

File tree

4 files changed

+0
-70
lines changed

4 files changed

+0
-70
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,6 @@
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>
459451
</section>
460452
<section id="web" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
461453
<label>Web</label>

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@
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>
3934
<general>
4035
<validator_data>
4136
<input_types>

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

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,56 +25,4 @@ protected function _productLimitationJoinPrice()
2525
$this->_productLimitationFilters->setUsePriceIndex(false);
2626
return $this->_productLimitationPrice(true);
2727
}
28-
29-
/**
30-
* Return approximately amount if too much entities.
31-
*
32-
* @return int|mixed
33-
*/
34-
public function getSize()
35-
{
36-
if ($this->_scopeConfig->getValue('admin/grid/show_approximate_products_amount_grid')) {
37-
$sql = $this->getSelectCountSql();
38-
return $this->analyzeCount($sql);
39-
}
40-
41-
return parent::getSize();
42-
}
43-
44-
/**
45-
* Analyze amount of entities in DB.
46-
*
47-
* @param $sql
48-
* @return int|mixed
49-
* @throws \Zend_Db_Statement_Exception
50-
*/
51-
private function analyzeCount($sql)
52-
{
53-
$results = $this->getConnection()->query('EXPLAIN ' . $sql)->fetchAll();
54-
$alias = $this->getMainTableAlias();
55-
56-
foreach ($results as $result) {
57-
if ($result['table'] == $alias) {
58-
return $result['rows'];
59-
}
60-
}
61-
62-
return 0;
63-
}
64-
65-
/**
66-
* Identify main table alias or its name if alias is not defined.
67-
*
68-
* @return string
69-
* @throws \LogicException
70-
*/
71-
private function getMainTableAlias()
72-
{
73-
foreach ($this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM) as $tableAlias => $tableMetadata) {
74-
if ($tableMetadata['joinType'] == 'from') {
75-
return $tableAlias;
76-
}
77-
}
78-
throw new \LogicException("Main table cannot be identified.");
79-
}
8028
}

app/code/Magento/Sales/etc/adminhtml/di.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,4 @@
4848
</argument>
4949
</arguments>
5050
</type>
51-
<type name="Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider\ProductCollection">
52-
<arguments>
53-
<argument name="collectionFactory" xsi:type="object">\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory</argument>
54-
</arguments>
55-
</type>
5651
</config>

0 commit comments

Comments
 (0)