TBT_Enhancedgrid - Version 1.1.1

Version Notes

- Changed some of the wording in the config

Download this release

Release Info

Developer Magento Core Team
Extension TBT_Enhancedgrid
Version 1.1.1
Comparing to
See all releases


Code changes from version 1.1 to 1.1.1

app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php.save ADDED
@@ -0,0 +1,560 @@
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Adminhtml
23
+ * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Adminhtml customer grid block
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Adminhtml
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
35
+ {
36
+ protected $isenhanced = true;
37
+ private $columnSettings = array();
38
+ private $columnOptions = array();
39
+ private $isenabled = true;
40
+
41
+ public function __construct()
42
+ {
43
+ parent::__construct();
44
+ $this->isenabled = Mage::getStoreConfig('enhancedgrid/general/isenabled');
45
+
46
+ $this->setId('productGrid');
47
+
48
+ $this->prepareDefaults();
49
+
50
+ $this->setSaveParametersInSession(true);
51
+ $this->setUseAjax(true);
52
+ $this->setVarNameFilter('product_filter');
53
+
54
+ $this->prepareColumnSettings();
55
+ $this->setTemplate('tbt/enhancedgrid/catalog/product/grid.phtml');
56
+
57
+ }
58
+
59
+ private function prepareDefaults() {
60
+ $this->setDefaultLimit(Mage::getStoreConfig('enhancedgrid/defaults/limit'));
61
+ $this->setDefaultPage(Mage::getStoreConfig('enhancedgrid/defaults/page'));
62
+ $this->setDefaultSort(Mage::getStoreConfig('enhancedgrid/defaults/sort'));
63
+ $this->setDefaultDir(Mage::getStoreConfig('enhancedgrid/defaults/dir'));
64
+
65
+ }
66
+
67
+ private function prepareColumnSettings() {
68
+ $storeSettings = Mage::getStoreConfig('enhancedgrid/columns/showcolumns');
69
+
70
+ $tempArr = explode(',', $storeSettings);
71
+
72
+ foreach($tempArr as $showCol) {
73
+ $this->columnSettings[trim($showCol)] = true;
74
+ }
75
+ }
76
+
77
+ public function colIsVisible($code) {
78
+ return isset($this->columnSettings[$code]);
79
+ }
80
+
81
+ protected function _prepareLayout()
82
+ {
83
+ $this->setChild('export_button',
84
+ $this->getLayout()->createBlock('adminhtml/widget_button')
85
+ ->setData(array(
86
+ 'label' => Mage::helper('adminhtml')->__('Export'),
87
+ 'onclick' => $this->getJsObjectName().'.doExport()',
88
+ 'class' => 'task'
89
+ ))
90
+ );
91
+ $this->setChild('reset_filter_button',
92
+ $this->getLayout()->createBlock('adminhtml/widget_button')
93
+ ->setData(array(
94
+ 'label' => Mage::helper('adminhtml')->__('Reset Filter'),
95
+ 'onclick' => $this->getJsObjectName().'.resetFilter()',
96
+ ))
97
+ );
98
+ $this->setChild('search_button',
99
+ $this->getLayout()->createBlock('adminhtml/widget_button')
100
+ ->setData(array(
101
+ 'label' => Mage::helper('adminhtml')->__('Search'),
102
+ 'onclick' => $this->getJsObjectName().'.doFilter()',
103
+ 'class' => 'task'
104
+ ))
105
+ );
106
+ return parent::_prepareLayout();
107
+ }
108
+ public function getQueryStr() {
109
+ return urldecode($this->getParam('q'));
110
+ }
111
+ protected function _prepareCollection()
112
+ {
113
+ $collection = $this->getCollection();
114
+ if($queryString = $this->getQueryStr()) {
115
+ $collection = Mage::Helper('enhancedgrid')
116
+ ->getSearchCollection($queryString, $this->getRequest());
117
+ }
118
+ if(!$collection) {
119
+ $collection = Mage::getModel('catalog/product')->getCollection();
120
+ }
121
+ $store = $this->_getStore();
122
+ $collection
123
+ ->joinField('qty',
124
+ 'cataloginventory/stock_item',
125
+ 'qty',
126
+ 'product_id=entity_id',
127
+ x '{{table}}.stock_id=1',
128
+ 'left');
129
+ $collection->addAttributeToSelect('sku');
130
+
131
+ //$collection->addAttributeToSelect('attribute_set_id');
132
+ //$collection->addAttributeToSelect('type_id');
133
+ //$collection->addAttributeToSelect('image'); // TODO remove this
134
+
135
+ if ($store->getId()) {
136
+ //$collection->setStoreId($store->getId());
137
+ $collection->addStoreFilter($store);
138
+ $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
139
+ $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
140
+ $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId());
141
+ $collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());
142
+ }
143
+ else {
144
+ $collection->addAttributeToSelect('price');
145
+ $collection->addAttributeToSelect('status');
146
+ $collection->addAttributeToSelect('visibility');
147
+ }
148
+ // EG: Select all needed columns.
149
+ //id,name,type,attribute_set,sku,price,qty,visibility,status,websites,image
150
+ foreach($this->columnSettings as $col => $true) {
151
+ if($col == 'qty' || $col == 'websites' || $col=='id') continue;
152
+ $collection->addAttributeToSelect($col);
153
+ }
154
+
155
+ $this->setCollection($collection);
156
+
157
+ $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
158
+ $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('XML'));
159
+
160
+ parent::_prepareCollection();
161
+ $collection->addWebsiteNamesToResult();
162
+
163
+ return $this;
164
+ }
165
+
166
+ /**
167
+ * if the attribute has options an options entry will be
168
+ * added to $columnOptions
169
+ * TODO: load first
170
+ */
171
+ private function loadColumnOptions($attr_code) {
172
+ $attr = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_product', $attr_code);
173
+ if(sizeof($attr->getData()) > 0) {
174
+ if($attr->getFrontendInput() == 'select') {
175
+ $values = Mage::getResourceModel('eav/entity_attribute_option_collection')
176
+ ->setAttributeFilter($attr->getId())
177
+ ->setStoreFilter($this->_getStore(), false)
178
+ ->load();
179
+ $options = array();
180
+ foreach($values as $value) {
181
+ $options[$value->getOptionId()] = $value->getValue();
182
+ }
183
+ //die($attr_code);
184
+ $this->columnOptions[$attr_code] = $options;
185
+ //die(print_r($this->columnOptions, true));
186
+ }
187
+ }
188
+
189
+ }
190
+
191
+
192
+ protected function _getStore()
193
+ {
194
+ $storeId = (int) $this->getRequest()->getParam('store', 0);
195
+ return Mage::app()->getStore($storeId);
196
+ }
197
+
198
+
199
+ protected function _addColumnFilterToCollection($column)
200
+ {
201
+ if ($this->getCollection()) {
202
+ if ($column->getId() == 'websites') {
203
+ $this->getCollection()->joinField('websites',
204
+ 'catalog/product_website',
205
+ 'website_id',
206
+ 'product_id=entity_id',
207
+ null,
208
+ 'left');
209
+ }
210
+ }
211
+ return parent::_addColumnFilterToCollection($column);
212
+ }
213
+
214
+ protected function _prepareColumns()
215
+ {
216
+ // Loads all the column options for each applicable column.
217
+ foreach($this->columnSettings as $col => $true) {
218
+ $this->loadColumnOptions($col);
219
+ }
220
+
221
+ $store = $this->_getStore();
222
+ if($this->colIsVisible('id')) {
223
+ $this->addColumn('id',
224
+ array(
225
+ 'header'=> Mage::helper('catalog')->__('ID'),
226
+ 'width' => '50px',
227
+ 'type' => 'number',
228
+ 'index' => 'entity_id',
229
+ ));
230
+ }
231
+
232
+ $imgWidth = Mage::getStoreConfig('enhancedgrid/images/width') + "px";
233
+
234
+ if($this->colIsVisible('thumbnail')) {
235
+ $this->addColumn('thumbnail',
236
+ array(
237
+ 'header'=> Mage::helper('catalog')->__('Thumbnail'),
238
+ 'type' => 'image',
239
+ 'width' => $imgWidth,
240
+ 'index' => 'thumbnail',
241
+ ));
242
+ }
243
+ if($this->colIsVisible('small_image')) {
244
+ $this->addColumn('small_image',
245
+ array(
246
+ 'header'=> Mage::helper('catalog')->__('Small Img'),
247
+ 'type' => 'image',
248
+ 'width' => $imgWidth,
249
+ 'index' => 'small_image',
250
+ ));
251
+ }
252
+ if($this->colIsVisible('image')) {
253
+ $this->addColumn('image',
254
+ array(
255
+ 'header'=> Mage::helper('catalog')->__('Image'),
256
+ 'type' => 'image',
257
+ 'width' => $imgWidth,
258
+ 'index' => 'image',
259
+ ));
260
+ }
261
+
262
+ if($this->colIsVisible('name')) {
263
+ $this->addColumn('name',
264
+ array(
265
+ 'header'=> Mage::helper('catalog')->__('Name'),
266
+ 'index' => 'name',
267
+ 'width' => '150px'
268
+ ));
269
+ }
270
+ if($this->colIsVisible('name')) {
271
+ if ($store->getId()) {
272
+ $this->addColumn('custom_name',
273
+ array(
274
+ 'header'=> Mage::helper('catalog')->__('Name In %s', $store->getName()),
275
+ 'index' => 'custom_name',
276
+ 'width' => '150px'
277
+ ));
278
+ }
279
+ }
280
+
281
+ if($this->colIsVisible('type_id')) {
282
+ $this->addColumn('type',
283
+ array(
284
+ 'header'=> Mage::helper('catalog')->__('Type'),
285
+ 'width' => '60px',
286
+ 'index' => 'type_id',
287
+ 'type' => 'options',
288
+ 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
289
+ ));
290
+ }
291
+
292
+
293
+ if($this->colIsVisible('attribute_set_id')) {
294
+ $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
295
+ ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
296
+ ->load()
297
+ ->toOptionHash();
298
+
299
+ $this->addColumn('set_name',
300
+ array(
301
+ 'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
302
+ 'width' => '100px',
303
+ 'index' => 'attribute_set_id',
304
+ 'type' => 'options',
305
+ 'options' => $sets,
306
+ ));
307
+ }
308
+
309
+ if($this->colIsVisible('sku')) {
310
+ $this->addColumn('sku',
311
+ array(
312
+ 'header'=> Mage::helper('catalog')->__('SKU'),
313
+ 'width' => '80px',
314
+ 'index' => 'sku',
315
+ ));
316
+ }
317
+
318
+
319
+ if($this->colIsVisible('price')) {
320
+ $this->addColumn('price',
321
+ array(
322
+ 'header'=> Mage::helper('catalog')->__('Price'),
323
+ 'type' => 'price',
324
+ 'currency_code' => $store->getBaseCurrency()->getCode(),
325
+ 'index' => 'price',
326
+ ));
327
+ }
328
+
329
+
330
+ if($this->colIsVisible('qty')) {
331
+ $this->addColumn('qty',
332
+ array(
333
+ 'header'=> Mage::helper('catalog')->__('Qty'),
334
+ 'width' => '100px',
335
+ 'type' => 'number',
336
+ 'index' => 'qty',
337
+ ));
338
+ }
339
+
340
+
341
+ if($this->colIsVisible('visibility')) {
342
+ $this->addColumn('visibility',
343
+ array(
344
+ 'header'=> Mage::helper('catalog')->__('Visibility'),
345
+ 'width' => '70px',
346
+ 'index' => 'visibility',
347
+ 'type' => 'options',
348
+ 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
349
+ ));
350
+ }
351
+
352
+
353
+ if($this->colIsVisible('status')) {
354
+ $this->addColumn('status',
355
+ array(
356
+ 'header'=> Mage::helper('catalog')->__('Status'),
357
+ 'width' => '70px',
358
+ 'index' => 'status',
359
+ 'type' => 'options',
360
+ 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
361
+ ));
362
+ }
363
+
364
+
365
+ if($this->colIsVisible('websites')) {
366
+ if (!Mage::app()->isSingleStoreMode()) {
367
+ $this->addColumn('websites',
368
+ array(
369
+ 'header'=> Mage::helper('catalog')->__('Websites'),
370
+ 'width' => '100px',
371
+ 'sortable' => false,
372
+ 'index' => 'websites',
373
+ 'type' => 'options',
374
+ 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
375
+ ));
376
+ }
377
+ }
378
+
379
+ // EG: Show all (other) needed columns.
380
+ $ignoreCols = array('id'=>true, 'websites'=>true,'status'=>true,'visibility'=>true,'qty'=>true,
381
+ 'price'=>true,'sku'=>true,'attribute_set_id'=>true, 'type_id'=>true,'name'=>true,
382
+ 'image'=>true, 'thumbnail' => true, 'small_image'=>true);
383
+ $currency = $store->getBaseCurrency()->getCode();
384
+ $truncate = Mage::getStoreConfig('enhancedgrid/general/truncatelongtextafter');
385
+ $defaults = array(
386
+ 'cost' => array('type'=>'price', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Cost'), 'currency_code' => $currency),
387
+ 'weight' => array('type'=>'number', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Weight')),
388
+ 'url_key' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Url Key')),
389
+ 'tier_price' => array('type'=>'price', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Tier Price'), 'currency_code' => $currency),
390
+ 'tax_class_id' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Tax Class ID')),
391
+ 'special_to_date' => array('type'=>'date', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Spshl TO Date')),
392
+ 'special_price' => array('type'=>'price', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Special Price'), 'currency_code' => $currency),
393
+ 'special_from_date' => array('type'=>'date', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Spshl FROM Date')),
394
+ 'color' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Color')),
395
+ 'size' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Size')),
396
+ 'brand' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Brand')),
397
+ 'custom_design' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design')),
398
+ 'custom_design_from' => array('type'=>'date', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design FRM')),
399
+ 'custom_design_to' => array('type'=>'date', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design TO')),
400
+ 'default_category_id' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Default Categry ID')),
401
+ 'dimension' => array('type'=>'text', 'width'=>'75px', 'header'=> Mage::helper('catalog')->__('Dimensions')),
402
+ 'manufacturer' => array('type'=>'text', 'width'=>'75px', 'header'=> Mage::helper('catalog')->__('Manufacturer')),
403
+ 'meta_keyword' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Meta Keywds')),
404
+ 'meta_description' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Meta Descr')),
405
+ 'meta_title' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Meta Title')),
406
+ 'short_description' => array('type'=>'text', 'width'=>'150px', 'header'=> Mage::helper('catalog')->__('Short Description'), 'string_limit'=>$truncate),
407
+ 'description' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Description'), 'string_limit'=>$truncate)
408
+ );
409
+ //id,name,type,attribute_set,sku,price,qty,visibility,status,websites,image
410
+ foreach($this->columnSettings as $col => $true) {
411
+ if(isset($ignoreCols[$col])) continue;
412
+ if(isset($defaults[$col])) {
413
+ $innerSettings = $defaults[$col];
414
+ } else {
415
+ $innerSettings = array(
416
+ 'header'=> Mage::helper('catalog')->__($col),
417
+ 'width' => '100px',
418
+ 'type' => 'text',
419
+ );
420
+ }
421
+ $innerSettings['index'] = $col;
422
+ //echo print_r($this->columnOptions, true);
423
+ if(isset($this->columnOptions[$col])) {
424
+ //die($col);
425
+ $innerSettings['type'] = 'options';
426
+ $innerSettings['options'] = $this->columnOptions[$col];
427
+ }
428
+ $this->addColumn($col, $innerSettings);
429
+ }
430
+
431
+ $this->addColumn('action',
432
+ array(
433
+ 'header' => Mage::helper('catalog')->__('Action'),
434
+ 'width' => '50px',
435
+ 'type' => 'action',
436
+ 'getter' => 'getId',
437
+ 'actions' => array(
438
+ array(
439
+ 'caption' => Mage::helper('catalog')->__('Edit'),
440
+ 'id' => "editlink",
441
+ 'url' => array(
442
+ 'base'=>'adminhtml/*/edit',
443
+ 'params'=>array('store'=>$this->getRequest()->getParam('store'))
444
+ ),
445
+ 'field' => 'id'
446
+ )
447
+ ),
448
+ 'filter' => false,
449
+ 'sortable' => false,
450
+ 'index' => 'stores',
451
+ ));
452
+
453
+ $this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
454
+
455
+ return parent::_prepareColumns();
456
+ }
457
+
458
+ protected function _prepareMassaction()
459
+ {
460
+ $this->setMassactionIdField('entity_id');
461
+ $this->getMassactionBlock()->setFormFieldName('product');
462
+
463
+ $this->getMassactionBlock()->addItem('delete', array(
464
+ 'label'=> Mage::helper('catalog')->__('Delete'),
465
+ 'url' => $this->getUrl('*/*/massDelete'),
466
+ 'confirm' => Mage::helper('catalog')->__('Are you sure?')
467
+ ));
468
+
469
+ $statuses = Mage::getSingleton('catalog/product_status')->getOptionArray();
470
+
471
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
472
+ $this->getMassactionBlock()->addItem('status', array(
473
+ 'label'=> Mage::helper('catalog')->__('Change status'),
474
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
475
+ 'additional' => array(
476
+ 'visibility' => array(
477
+ 'name' => 'status',
478
+ 'type' => 'select',
479
+ 'class' => 'required-entry',
480
+ 'label' => Mage::helper('catalog')->__('Status'),
481
+ 'values' => $statuses
482
+ )
483
+ )
484
+ ));
485
+
486
+ $this->getMassactionBlock()->addItem('attributes', array(
487
+ 'label' => Mage::helper('catalog')->__('Update attributes'),
488
+ 'url' => $this->getUrl('adminhtml/catalog_product_action_attribute/edit', array('_current'=>true))
489
+ ));
490
+
491
+
492
+ // Divider
493
+ $this->getMassactionBlock()->addItem('imagesDivider', $this->getMADivider("Images"));
494
+
495
+ // Show images...
496
+ $imgWidth = Mage::getStoreConfig('enhancedgrid/images/width') ;
497
+ $imgHeight = Mage::getStoreConfig('enhancedgrid/images/height');
498
+ $this->getMassactionBlock()->addItem('showImages', array(
499
+ 'label' => $this->__('Show Selected Images'),
500
+ 'url' => $this->getUrl('*/*/index', array('_current'=>true)),
501
+ 'callback' => 'showSelectedImages(productGrid_massactionJsObject, '
502
+ .'{checkedValues}, \'<img src=\\\'{imgurl}\\\' width='.$imgWidth
503
+ .' height='.$imgHeight.' border=0 />\')'
504
+
505
+ ));
506
+ // Hide Images
507
+ $this->getMassactionBlock()->addItem('hideImages', array(
508
+ 'label' => $this->__('Hide Selected Images'),
509
+ 'url' => $this->getUrl('*/*/index', array('_current'=>true)),
510
+ 'callback' => 'hideSelectedImages(productGrid_massactionJsObject, {checkedValues})'
511
+
512
+ ));
513
+
514
+ // Divider 3
515
+ $this->getMassactionBlock()->addItem('otherDivider', $this->getMADivider("Other"));
516
+
517
+ // Opens all products
518
+
519
+ // Refresh...
520
+ $this->getMassactionBlock()->addItem('refreshProducts', array(
521
+ 'label' => $this->__('Refresh Products'),
522
+ 'url' => $this->getUrl('*/*/massRefreshProducts', array('_current'=>true))
523
+ ));
524
+
525
+ // $this->getMassactionBlock()->addItem('saveEditables', array(
526
+ // 'label' => $this->__('SAVE EDITABLES'),
527
+ // 'url' => $this->getUrl('*/*/saveEditables', array('_current'=>true)),
528
+ // 'fields' => array('short_description2', '')
529
+ // ));
530
+
531
+
532
+ return $this;
533
+ }
534
+
535
+
536
+ public function getRowUrl($row)
537
+ {
538
+ return $this->getUrl('adminhtml/catalog_product/edit', array(
539
+ 'store'=>$this->getRequest()->getParam('store'),
540
+ 'id'=>$row->getId())
541
+ );
542
+ }
543
+
544
+ public function getGridUrl()
545
+ {
546
+ return $this->getUrl('*/*/grid', array('_current'=>true));
547
+ }
548
+
549
+
550
+
551
+ protected function getMADivider($dividerHeading="-------") {
552
+ $dividerTemplate = array(
553
+ 'label' => '--------'.$this->__($dividerHeading).'--------',
554
+ 'url' => $this->getUrl('*/*/index', array('_current'=>true)),
555
+ 'callback' => "null"
556
+ );
557
+ return $dividerTemplate;
558
+ }
559
+
560
+ }
app/code/community/TBT/Enhancedgrid/Block/System/Html.php ADDED
@@ -0,0 +1,78 @@
1
+ <?php
2
+ /**
3
+ * aheadWorks Co.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the EULA
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://ecommerce.aheadworks.com/LICENSE-M1.txt
11
+ *
12
+ * @category AW
13
+ * @package AW_All
14
+ * @copyright Copyright (c) 2003-2009 aheadWorks Co. (http://www.aheadworks.com)
15
+ * @license http://ecommerce.aheadworks.com/LICENSE-M1.txt
16
+ */
17
+
18
+
19
+ class TBT_Enhancedgrid_Block_System_Html
20
+ extends Mage_Adminhtml_Block_System_Config_Form_Fieldset
21
+ {
22
+ protected $_dummyElement;
23
+ protected $_fieldRenderer;
24
+ protected $_values;
25
+
26
+ public function render(Varien_Data_Form_Element_Abstract $element)
27
+ {
28
+
29
+ $html = "";
30
+ $html .= "<div style=\"border: medium dotted ; padding: 6px; font-weight: bold; margin-bottom: 12px; width: 430px;\">".
31
+ "This extension was provided by WDCA. <a href='http://wdca.ca/solutions_page_magento_ext.html' target='_blank'>Click here</a> for more from WDCA.</a><BR /> ".
32
+ "Try our new <a href=\"http://www.GetSweetTooth.com\" target=\"_blank\">Sweet Tooth Points & Rewards</a> Magento Extension.</div>";
33
+ $html .= "";//$this->_getFooterHtml($element);
34
+
35
+ return $html;
36
+ }
37
+
38
+ protected function _getDummyElement()
39
+ {
40
+ if (empty($this->_dummyElement)) {
41
+ $this->_dummyElement = new Varien_Object(array('show_in_default'=>1, 'show_in_website'=>1));
42
+ }
43
+ return $this->_dummyElement;
44
+ }
45
+
46
+ protected function _getFieldRenderer()
47
+ {
48
+ if (empty($this->_fieldRenderer)) {
49
+ $this->_fieldRenderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
50
+ }
51
+ return $this->_fieldRenderer;
52
+ }
53
+
54
+ protected function _getFieldHtml($fieldset, $moduleName)
55
+ {
56
+ $configData = $this->getConfigData();
57
+ $path = 'advanced/modules_disable_output/'.$moduleName; //TODO: move as property of form
58
+ $data = isset($configData[$path]) ? $configData[$path] : array();
59
+
60
+ $e = $this->_getDummyElement();
61
+
62
+ $moduleKey = substr($moduleName, strpos($moduleName,'_')+1);
63
+ $ver = (Mage::getConfig()->getModuleConfig($moduleName)->version);
64
+
65
+
66
+ if($ver){
67
+ $field = $fieldset->addField($moduleName, 'label',
68
+ array(
69
+ 'name' => 'ssssss',
70
+ 'label' => $moduleName,
71
+ 'value' => $ver
72
+ ))->setRenderer($this->_getFieldRenderer());
73
+ return $field->toHtml();
74
+ }
75
+ return '';
76
+
77
+ }
78
+ }
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php CHANGED
@@ -75,7 +75,6 @@ class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Admi
75
$val = $val2 = $row->getData($this->getColumn()->getIndex());
76
$url = Mage::helper('enhancedgrid')->getImageUrl($val);
77
78
-
79
if(!Mage::helper('enhancedgrid')->getFileExists($val)) {
80
$dored =true;
81
$val .= "[!]";
@@ -99,7 +98,7 @@ class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Admi
99
$out .= "<img src=". $url ." width='". self::$width ."' ";
100
$out .= "height='". self::$height ."' /> ";
101
}
102
-
103
$out .= '</a></center>';
104
105
return $out;
75
$val = $val2 = $row->getData($this->getColumn()->getIndex());
76
$url = Mage::helper('enhancedgrid')->getImageUrl($val);
77
78
if(!Mage::helper('enhancedgrid')->getFileExists($val)) {
79
$dored =true;
80
$val .= "[!]";
98
$out .= "<img src=". $url ." width='". self::$width ."' ";
99
$out .= "height='". self::$height ."' /> ";
100
}
101
+ //die( $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135));
102
$out .= '</a></center>';
103
104
return $out;
app/code/community/TBT/Enhancedgrid/etc/config.xml CHANGED
@@ -25,26 +25,31 @@
25
</routers>
26
</admin>
27
28
- <global>
29
- <blocks>
30
- <enhancedgrid>
31
- <class>TBT_Enhancedgrid_Block</class>
32
- </enhancedgrid>
33
- </blocks>
34
- <helpers>
35
- <enhancedgrid>
36
- <class>TBT_Enhancedgrid_Helper</class>
37
- </enhancedgrid>
38
- </helpers>
39
- <blocks>
40
- <adminhtml>
41
- <rewrite>
42
- <widget_grid_column>TBT_Enhancedgrid_Block_Widget_Grid_Column</widget_grid_column>
43
- </rewrite>
44
- </adminhtml>
45
- </blocks>
46
47
- <!-- Relate Stuff -->
48
</global>
49
50
<adminhtml>
25
</routers>
26
</admin>
27
28
+ <global>
29
+ <blocks>
30
+ <enhancedgrid>
31
+ <class>TBT_Enhancedgrid_Block</class>
32
+ </enhancedgrid>
33
+ </blocks>
34
+ <helpers>
35
+ <enhancedgrid>
36
+ <class>TBT_Enhancedgrid_Helper</class>
37
+ </enhancedgrid>
38
+ </helpers>
39
+ <blocks>
40
+ <adminhtml>
41
+ <rewrite>
42
+ <widget_grid_column>TBT_Enhancedgrid_Block_Widget_Grid_Column</widget_grid_column>
43
+ </rewrite>
44
+ </adminhtml>
45
+ </blocks>
46
47
+ <!-- rewrite>
48
+ <tbt_enhancedgrid_catalog_product>
49
+ <from><![CDATA[#^/adminhtml/catalog_product/((index.*))/$#]]></from>
50
+ <to>/enhancedgrid/catalog_product/${1}/</to>
51
+ </tbt_enhancedgrid_catalog_product>
52
+ </rewrite -->
53
</global>
54
55
<adminhtml>
app/code/community/TBT/Enhancedgrid/etc/system.xml CHANGED
@@ -20,19 +20,19 @@
20
<groups>
21
<columns translate="label">
22
<label>General Options</label>
23
- <comment>------ Need More Custom E-Commerce Solutions Like This? We can help! Contact Jay at "jaye@tbtcorp.com" for more info. ------</comment>
24
<sort_order>200</sort_order>
25
<show_in_default>1</show_in_default>
26
<show_in_website>1</show_in_website>
27
- <fields>
28
- <!--isenabled translate="label">
29
- <label>Enable Enhanced Grid</label>
30
- <frontend_type>select</frontend_type>
31
- <source_model>adminhtml/system_config_source_yesno</source_model>
32
<sort_order>10</sort_order>
33
<show_in_default>1</show_in_default>
34
<show_in_website>1</show_in_website>
35
- </isenabled-->
36
<showcolumns translate="label">
37
<label>Show Columns</label>
38
<frontend_type>multiselect</frontend_type>
20
<groups>
21
<columns translate="label">
22
<label>General Options</label>
23
<sort_order>200</sort_order>
24
<show_in_default>1</show_in_default>
25
<show_in_website>1</show_in_website>
26
+ <fields>
27
+ <notice translate="label">
28
+ <label>Extension Information Provided By WWW.WDCA.CA</label>
29
+ <frontend_type>text</frontend_type>
30
+ <frontend_model>enhancedgrid/system_html</frontend_model>
31
<sort_order>10</sort_order>
32
<show_in_default>1</show_in_default>
33
<show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ </notice>
36
<showcolumns translate="label">
37
<label>Show Columns</label>
38
<frontend_type>multiselect</frontend_type>
package.xml CHANGED
@@ -1,21 +1,18 @@
1
<?xml version="1.0"?>
2
<package>
3
<name>TBT_Enhancedgrid</name>
4
- <version>1.1</version>
5
<stability>stable</stability>
6
<license>OSL 3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Enhances the product grid to add a bunch of convenient features.</summary>
10
<description>Enhances the product grid to add a bunch of convenient features.</description>
11
- <notes>- Now compatible with Magento ver. 1.0.19870.6 up to 1.2.1.2
12
- - Added support for columns that have "drop-down" values.
13
- - Fixed bug that broke "add new product" url
14
- - Fixed bug that broke "update attributes" url.</notes>
15
<authors><author><name>Jay</name><user>auto-converted</user><email>najibkaake@gmail.com</email></author></authors>
16
- <date>2009-03-22</date>
17
- <time>01:49:15</time>
18
- <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="ef12b7e54560a59ee8a92f7cae2688c4"/></dir><dir name="template"><dir name="tbt"><dir name="enhancedgrid"><dir name="catalog"><dir name="product"><file name="grid.phtml" hash="8e39bb3abd59ef4ba12fdf4d725dda90"/></dir><file name="product.phtml" hash="5fceede9ce2aaee2f33f97f106db4eaa"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="tbt"><dir name="enhancedgrid"><dir name="customfunctions"><file name="catalog_products.js" hash="db00553aa26aa6851f92f84447f3cd14"/></dir><dir name="resources"><dir name="css"><file name="enhancedgrid.css" hash="a219b0e656329f2407835dbe346f81d3"/></dir></dir><file name="egsupplemental.js" hash="da3aa882d47a41c4d2f7d0c48233ae1e"/><file name="enhancedgrid.js" hash="fcbbe08d942719a668d3536246664628"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TBT_Enhancedgrid.xml" hash="85a6ca652ec3777aa244a78c1c4fdac4"/></dir></target><target name="magecommunity"><dir name="TBT"><dir name="Enhancedgrid"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="7f9d3061f3abc62a4910700a36fb9434"/></dir><file name="Product.php" hash="a6348f1f8ce10e628fb27537a659fafb"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Image.php" hash="b1e25d3e8d03a0869e1c2edf5fcdd761"/></dir><dir name="Renderer"><file name="Action.php" hash="32c3917ad4c07942e9f0d003c6854b2b"/><file name="Image.php" hash="9639860b3ad18b08b835e145c2ec95ea"/></dir></dir><file name="Column.php" hash="51e74c94d0d6599cadd948a054d475af"/></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="458c71ecefebbce18bc95b162e6dfc65"/></dir></dir><dir name="etc"><file name="config.xml" hash="71721df4637ea2776c54fa741046b6b9"/><file name="system.xml" hash="0358fa988da45162ac9ce4ea64246ac2"/></dir><dir name="Helper"><file name="Data.php" hash="5ef9a7ad806e6b25bd34453851a7977e"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Columns"><file name="Show.php" hash="18a3eafdda1d53c942788ccbdfb77746"/></dir><dir name="Sort"><file name="Direction.php" hash="23cb37d1af2dd75c3c9537adf90c1bc8"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
19
<compatible/>
20
<dependencies/>
21
</package>
1
<?xml version="1.0"?>
2
<package>
3
<name>TBT_Enhancedgrid</name>
4
+ <version>1.1.1</version>
5
<stability>stable</stability>
6
<license>OSL 3.0</license>
7
<channel>community</channel>
8
<extends/>
9
<summary>Enhances the product grid to add a bunch of convenient features.</summary>
10
<description>Enhances the product grid to add a bunch of convenient features.</description>
11
+ <notes>- Changed some of the wording in the config</notes>
12
<authors><author><name>Jay</name><user>auto-converted</user><email>najibkaake@gmail.com</email></author></authors>
13
+ <date>2009-12-08</date>
14
+ <time>10:23:29</time>
15
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="ef12b7e54560a59ee8a92f7cae2688c4"/></dir><dir name="template"><dir name="tbt"><dir name="enhancedgrid"><dir name="catalog"><dir name="product"><file name="grid.phtml" hash="8e39bb3abd59ef4ba12fdf4d725dda90"/></dir><file name="product.phtml" hash="5fceede9ce2aaee2f33f97f106db4eaa"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="tbt"><dir name="enhancedgrid"><dir name="customfunctions"><file name="catalog_products.js" hash="db00553aa26aa6851f92f84447f3cd14"/></dir><dir name="resources"><dir name="css"><file name="enhancedgrid.css" hash="a219b0e656329f2407835dbe346f81d3"/></dir></dir><file name="egsupplemental.js" hash="da3aa882d47a41c4d2f7d0c48233ae1e"/><file name="enhancedgrid.js" hash="fcbbe08d942719a668d3536246664628"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="TBT_Enhancedgrid.xml" hash="85a6ca652ec3777aa244a78c1c4fdac4"/></dir></target><target name="magecommunity"><dir name="TBT"><dir name="Enhancedgrid"><dir name="Block"><dir name="Catalog"><dir name="Product"><file name="Grid.php" hash="7f9d3061f3abc62a4910700a36fb9434"/><file name="Grid.php.save" hash="3855030218c93a7c49a2e0caab7100c1"/></dir><file name="Product.php" hash="a6348f1f8ce10e628fb27537a659fafb"/></dir><dir name="System"><file name="Html.php" hash="4774d3ea83b58aeb914adb966ac9f0f4"/></dir><dir name="Widget"><dir name="Grid"><dir name="Column"><dir name="Filter"><file name="Image.php" hash="b1e25d3e8d03a0869e1c2edf5fcdd761"/></dir><dir name="Renderer"><file name="Action.php" hash="32c3917ad4c07942e9f0d003c6854b2b"/><file name="Image.php" hash="ae48c83e961798c1502bb7fc1e3bc789"/></dir></dir><file name="Column.php" hash="51e74c94d0d6599cadd948a054d475af"/></dir></dir></dir><dir name="controllers"><dir name="Catalog"><file name="ProductController.php" hash="458c71ecefebbce18bc95b162e6dfc65"/></dir></dir><dir name="etc"><file name="config.xml" hash="0e22ff5c10ee88289bc0c0705bbdb264"/><file name="system.xml" hash="b57884a38404b67e2fa5b90548ba2992"/></dir><dir name="Helper"><file name="Data.php" hash="5ef9a7ad806e6b25bd34453851a7977e"/></dir><dir name="Model"><dir name="System"><dir name="Config"><dir name="Source"><dir name="Columns"><file name="Show.php" hash="18a3eafdda1d53c942788ccbdfb77746"/></dir><dir name="Sort"><file name="Direction.php" hash="23cb37d1af2dd75c3c9537adf90c1bc8"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
16
<compatible/>
17
<dependencies/>
18
</package>