Skip to content

Commit d34be82

Browse files
sreichelkiatng
andauthored
Unified admin grid columns and added XML configuration (OpenMage#4225)
* Fixes price filter * Fixes price filter (test) * copyright * Unified grid columns - makes all "entity_id" grid columns searchable "from" "to" - disallow/ignore non-numeric input on price/currency/range grid columns - removed useless "'sortable' => true" * Increased width * Unified "edit" column * Unified "action" column * Unified "store" column * Use config from XML * Added test * phpcs * Update tests/unit/Mage/Adminhtml/Block/Widget/GridTest.php Removed usseles line * typo * Unified "currency" column * Unified "price" column * Unified "currency" column * Unified "currency" column - added config helper * Unified "number" column - removed useless align right * updated copyright dates * cleanup * Removed "from" "to" label to safe space - add input placeholder * Typo [skip ci] * Re-added "from" "to" label to legacy theme * Flush cache once if an old config is cached * Hide placeholder in legacy theme * Update app/code/core/Mage/Oauth/Block/Adminhtml/Oauth/Consumer/Grid.php Co-authored-by: Ng Kiat Siong <[email protected]> * Update app/code/core/Mage/Adminhtml/Block/Widget/Grid.php Co-authored-by: Ng Kiat Siong <[email protected]> --------- Co-authored-by: Ng Kiat Siong <[email protected]>
1 parent b5f6492 commit d34be82

File tree

110 files changed

+495
-513
lines changed

Some content is hidden

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

110 files changed

+495
-513
lines changed

.phpstan.dist.baseline.neon

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,6 @@ parameters:
570570
count: 1
571571
path: app/code/core/Mage/Adminhtml/Block/Widget/Form.php
572572

573-
-
574-
message: "#^Property Mage_Adminhtml_Block_Widget_Grid\\:\\:\\$defaultColumnSettings \\(array\\<array\\<array\\>\\>\\) does not accept default value of type array\\<string, array\\<string, int\\>\\>\\.$#"
575-
count: 1
576-
path: app/code/core/Mage/Adminhtml/Block/Widget/Grid.php
577-
578573
-
579574
message: "#^Parameter \\#1 \\$emptyLabel of method Mage_Directory_Model_Resource_Country_Collection\\:\\:toOptionArray\\(\\) expects string, false given\\.$#"
580575
count: 1
@@ -3435,11 +3430,6 @@ parameters:
34353430
count: 1
34363431
path: app/code/core/Mage/Core/Model/Cache.php
34373432

3438-
-
3439-
message: "#^Method Mage_Core_Model_Config\\:\\:getNode\\(\\) should return Mage_Core_Model_Config_Element but returns Varien_Simplexml_Element\\|false\\.$#"
3440-
count: 1
3441-
path: app/code/core/Mage/Core/Model/Config.php
3442-
34433433
-
34443434
message: "#^Parameter \\#1 \\$options of method Mage_Core_Model_Config\\:\\:reinit\\(\\) expects array, Mage_Core_Model_Config_Options given\\.$#"
34453435
count: 1

app/code/core/Mage/Adminhtml/Block/Api/Role/Grid/User.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ protected function _prepareColumns()
8888
'header' => Mage::helper('adminhtml')->__('User ID'),
8989
'width' => 5,
9090
'align' => 'left',
91-
'sortable' => true,
9291
'index' => 'user_id'
9392
]);
9493

app/code/core/Mage/Adminhtml/Block/Api/User/Grid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -43,7 +43,6 @@ protected function _prepareColumns()
4343
'header' => Mage::helper('adminhtml')->__('ID'),
4444
'width' => 5,
4545
'align' => 'right',
46-
'sortable' => true,
4746
'index' => 'user_id'
4847
]);
4948

app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ protected function _prepareColumns()
117117

118118
$this->addColumn('entity_id', [
119119
'header' => Mage::helper('catalog')->__('ID'),
120-
'sortable' => true,
121-
'width' => '60',
122120
'index' => 'entity_id'
123121
]);
124122

@@ -171,10 +169,8 @@ protected function _prepareColumns()
171169
]);
172170

173171
$this->addColumn('price', [
174-
'header' => Mage::helper('catalog')->__('Price'),
175-
'type' => 'currency',
176-
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
177-
'index' => 'price'
172+
'type' => 'currency',
173+
'currency_code' => Mage_Directory_Helper_Data::getConfigCurrencyBase(),
178174
]);
179175

180176
$this->addColumn('position', [
@@ -186,8 +182,6 @@ protected function _prepareColumns()
186182
]);
187183

188184
$this->addColumn('action', [
189-
'header' => Mage::helper('catalog')->__('Action'),
190-
'width' => '50px',
191185
'type' => 'action',
192186
'getter' => 'getId',
193187
'actions' => [
@@ -205,8 +199,6 @@ protected function _prepareColumns()
205199
],
206200
],
207201
],
208-
'filter' => false,
209-
'sortable' => false,
210202
'index' => 'stores',
211203
]);
212204

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Grid.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -46,7 +46,6 @@ protected function _prepareColumns()
4646

4747
$this->addColumnAfter('is_visible', [
4848
'header' => Mage::helper('catalog')->__('Visible'),
49-
'sortable' => true,
5049
'index' => 'is_visible_on_front',
5150
'type' => 'options',
5251
'options' => [
@@ -58,7 +57,6 @@ protected function _prepareColumns()
5857

5958
$this->addColumnAfter('is_global', [
6059
'header' => Mage::helper('catalog')->__('Scope'),
61-
'sortable' => true,
6260
'index' => 'is_global',
6361
'type' => 'options',
6462
'options' => [
@@ -71,7 +69,6 @@ protected function _prepareColumns()
7169

7270
$this->addColumnAfter('is_searchable', [
7371
'header' => Mage::helper('catalog')->__('Searchable'),
74-
'sortable' => true,
7572
'index' => 'is_searchable',
7673
'type' => 'options',
7774
'options' => [
@@ -83,7 +80,6 @@ protected function _prepareColumns()
8380

8481
$this->addColumnAfter('is_filterable', [
8582
'header' => Mage::helper('catalog')->__('Use in Layered Navigation'),
86-
'sortable' => true,
8783
'index' => 'is_filterable',
8884
'type' => 'options',
8985
'options' => [
@@ -96,7 +92,6 @@ protected function _prepareColumns()
9692

9793
$this->addColumnAfter('is_comparable', [
9894
'header' => Mage::helper('catalog')->__('Comparable'),
99-
'sortable' => true,
10095
'index' => 'is_comparable',
10196
'type' => 'options',
10297
'options' => [

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Attribute/Set/Grid.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -49,7 +49,6 @@ protected function _prepareColumns()
4949
$this->addColumn('set_name', [
5050
'header' => Mage::helper('catalog')->__('Set Name'),
5151
'align' => 'left',
52-
'sortable' => true,
5352
'index' => 'attribute_set_name',
5453
]);
5554

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Alerts/Price.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2022-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -72,11 +72,9 @@ protected function _prepareColumns()
7272
]);
7373

7474
$this->addColumn('price', [
75-
'header' => Mage::helper('catalog')->__('Price'),
76-
'index' => 'price',
7775
'type' => 'currency',
7876
'currency_code'
79-
=> Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE)
77+
=> Mage_Directory_Helper_Data::getConfigCurrencyBase(),
8078
]);
8179

8280
$this->addColumn('add_date', [

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Crosssell.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -128,8 +128,6 @@ protected function _prepareColumns()
128128

129129
$this->addColumn('entity_id', [
130130
'header' => Mage::helper('catalog')->__('ID'),
131-
'sortable' => true,
132-
'width' => 60,
133131
'index' => 'entity_id'
134132
]);
135133

@@ -182,10 +180,8 @@ protected function _prepareColumns()
182180
]);
183181

184182
$this->addColumn('price', [
185-
'header' => Mage::helper('catalog')->__('Price'),
186183
'type' => 'currency',
187-
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
188-
'index' => 'price'
184+
'currency_code' => Mage_Directory_Helper_Data::getConfigCurrencyBase(),
189185
]);
190186

191187
$this->addColumn('position', [

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Related.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @category Mage
1010
* @package Mage_Adminhtml
1111
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
12-
* @copyright Copyright (c) 2019-2023 The OpenMage Contributors (https://www.openmage.org)
12+
* @copyright Copyright (c) 2019-2024 The OpenMage Contributors (https://www.openmage.org)
1313
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1414
*/
1515

@@ -130,8 +130,6 @@ protected function _prepareColumns()
130130

131131
$this->addColumn('entity_id', [
132132
'header' => Mage::helper('catalog')->__('ID'),
133-
'sortable' => true,
134-
'width' => 60,
135133
'index' => 'entity_id'
136134
]);
137135

@@ -184,10 +182,8 @@ protected function _prepareColumns()
184182
]);
185183

186184
$this->addColumn('price', [
187-
'header' => Mage::helper('catalog')->__('Price'),
188185
'type' => 'currency',
189-
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
190-
'index' => 'price'
186+
'currency_code' => Mage_Directory_Helper_Data::getConfigCurrencyBase(),
191187
]);
192188

193189
$this->addColumn('position', [

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tab/Super/Config/Grid.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ protected function _prepareColumns()
198198

199199
$this->addColumn('entity_id', [
200200
'header' => Mage::helper('catalog')->__('ID'),
201-
'sortable' => true,
202-
'width' => '60px',
203201
'index' => 'entity_id'
204202
]);
205203
$this->addColumn('name', [
@@ -230,10 +228,8 @@ protected function _prepareColumns()
230228
]);
231229

232230
$this->addColumn('price', [
233-
'header' => Mage::helper('catalog')->__('Price'),
234231
'type' => 'currency',
235-
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
236-
'index' => 'price'
232+
'currency_code' => Mage_Directory_Helper_Data::getConfigCurrencyBase(),
237233
]);
238234

239235
$this->addColumn('is_saleable', [
@@ -257,7 +253,6 @@ protected function _prepareColumns()
257253
$this->addColumn(
258254
'action',
259255
[
260-
'header' => Mage::helper('catalog')->__('Action'),
261256
'type' => 'action',
262257
'getter' => 'getId',
263258
'actions' => [
@@ -268,8 +263,6 @@ protected function _prepareColumns()
268263
'onclick' => 'superProduct.createPopup(this.href);return false;'
269264
]
270265
],
271-
'filter' => false,
272-
'sortable' => false
273266
]
274267
);
275268

0 commit comments

Comments
 (0)