File tree Expand file tree Collapse file tree 4 files changed +0
-70
lines changed
Catalog/Ui/DataProvider/Product Expand file tree Collapse file tree 4 files changed +0
-70
lines changed Original file line number Diff line number Diff line change 448
448
<source_model >Magento\Config\Model\Config\Source\Yesno</source_model >
449
449
</field >
450
450
</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 >
459
451
</section >
460
452
<section id =" web" translate =" label" type =" text" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
461
453
<label >Web</label >
Original file line number Diff line number Diff line change 31
31
<max_height >1200</max_height >
32
32
</upload_configuration >
33
33
</system >
34
- <admin >
35
- <grid >
36
- <show_approximate_products_amount_grid >0</show_approximate_products_amount_grid >
37
- </grid >
38
- </admin >
39
34
<general >
40
35
<validator_data >
41
36
<input_types >
Original file line number Diff line number Diff line change @@ -25,56 +25,4 @@ protected function _productLimitationJoinPrice()
25
25
$ this ->_productLimitationFilters ->setUsePriceIndex (false );
26
26
return $ this ->_productLimitationPrice (true );
27
27
}
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
- }
80
28
}
Original file line number Diff line number Diff line change 48
48
</argument >
49
49
</arguments >
50
50
</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 >
56
51
</config >
You can’t perform that action at this time.
0 commit comments