Version Notes
- Added Magento 1.4 compatibility
- Made images in the grid maintain their proportions when the height attribute is smaller than or equal to the weight attribute as configured in the back-end image display config for the grid.
- Now rewrites Magento's existing product grid. To turn off Enhanced Product Grid modify the app/etc/modules/TBT_Enhancedgrid.cml file and set the 'active' value to 'false'
- Fixed a column spacing issue that would even out the columns. Now the NAME column takes any remaining column space.
- Removed some unneeded files.
- Changed the structure of the configuration section
Download this release
Release Info
Developer | Magento Core Team |
Extension | TBT_Enhancedgrid |
Version | 1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.2
- app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php +12 -12
- app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php.save +0 -560
- app/code/community/TBT/Enhancedgrid/Block/System/Html.php +19 -10
- app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php +20 -11
- app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Columns/Show.php +26 -1
- app/code/community/TBT/Enhancedgrid/etc/system.xml +19 -12
- app/design/adminhtml/default/default/layout/tbt_enhancedgrid.xml +18 -15
- package.xml +11 -6
app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -18,18 +18,18 @@
|
|
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
|
22 |
-
* @package
|
23 |
-
* @copyright Copyright (c) 2008
|
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
|
31 |
-
* @package
|
32 |
-
* @author
|
33 |
*/
|
34 |
class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
{
|
@@ -112,7 +112,7 @@ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_W
|
|
112 |
{
|
113 |
$collection = $this->getCollection();
|
114 |
if($queryString = $this->getQueryStr()) {
|
115 |
-
$collection = Mage::
|
116 |
->getSearchCollection($queryString, $this->getRequest());
|
117 |
}
|
118 |
if(!$collection) {
|
@@ -134,7 +134,7 @@ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_W
|
|
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());
|
@@ -174,7 +174,7 @@ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_W
|
|
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) {
|
@@ -264,7 +264,7 @@ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_W
|
|
264 |
array(
|
265 |
'header'=> Mage::helper('catalog')->__('Name'),
|
266 |
'index' => 'name',
|
267 |
-
'width' => '150px'
|
268 |
));
|
269 |
}
|
270 |
if($this->colIsVisible('name')) {
|
@@ -543,7 +543,7 @@ class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_W
|
|
543 |
|
544 |
public function getGridUrl()
|
545 |
{
|
546 |
-
return $this->getUrl('
|
547 |
}
|
548 |
|
549 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WDCA
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
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 WDCA
|
22 |
+
* @package TBT_Enhancedgrid
|
23 |
+
* @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
|
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 WDCA
|
31 |
+
* @package TBT_Enhancedgrid
|
32 |
+
* @author WDCA <contact@wdca.ca>
|
33 |
*/
|
34 |
class TBT_Enhancedgrid_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
35 |
{
|
112 |
{
|
113 |
$collection = $this->getCollection();
|
114 |
if($queryString = $this->getQueryStr()) {
|
115 |
+
$collection = Mage::helper('enhancedgrid')
|
116 |
->getSearchCollection($queryString, $this->getRequest());
|
117 |
}
|
118 |
if(!$collection) {
|
134 |
|
135 |
if ($store->getId()) {
|
136 |
//$collection->setStoreId($store->getId());
|
137 |
+
$collection->addStoreFilter($store->getId());
|
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());
|
174 |
if($attr->getFrontendInput() == 'select') {
|
175 |
$values = Mage::getResourceModel('eav/entity_attribute_option_collection')
|
176 |
->setAttributeFilter($attr->getId())
|
177 |
+
->setStoreFilter($this->_getStore()->getId(), false)
|
178 |
->load();
|
179 |
$options = array();
|
180 |
foreach($values as $value) {
|
264 |
array(
|
265 |
'header'=> Mage::helper('catalog')->__('Name'),
|
266 |
'index' => 'name',
|
267 |
+
// 'width' => '150px'
|
268 |
));
|
269 |
}
|
270 |
if($this->colIsVisible('name')) {
|
543 |
|
544 |
public function getGridUrl()
|
545 |
{
|
546 |
+
return $this->getUrl('enhancedgrid/*/grid', array('_current'=>true));
|
547 |
}
|
548 |
|
549 |
|
app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php.save
DELETED
@@ -1,560 +0,0 @@
|
|
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
CHANGED
@@ -1,18 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
7 |
-
* This source file is subject to the
|
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://
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
*
|
12 |
-
* @category
|
13 |
-
* @package
|
14 |
-
* @copyright Copyright (c)
|
15 |
-
* @license http://
|
16 |
*/
|
17 |
|
18 |
|
@@ -27,9 +36,9 @@ class TBT_Enhancedgrid_Block_System_Html
|
|
27 |
{
|
28 |
|
29 |
$html = "";
|
30 |
-
$html .= "<div style=\"
|
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;
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WDCA
|
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 WDCA
|
22 |
+
* @package TBT_Enhancedgrid
|
23 |
+
* @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
*/
|
26 |
|
27 |
|
36 |
{
|
37 |
|
38 |
$html = "";
|
39 |
+
$html .= "<div style=\" margin-bottom: 12px; width: 430px;\">".
|
40 |
"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 /> ".
|
41 |
+
"<BR />Try our new <a href=\"http://www.GetSweetTooth.com\" target=\"_blank\">Sweet Tooth Points & Rewards</a> Magento Extension.</div>";
|
42 |
$html .= "";//$this->_getFooterHtml($element);
|
43 |
|
44 |
return $html;
|
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
@@ -12,18 +12,18 @@
|
|
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 |
-
* @category
|
16 |
-
* @package
|
17 |
-
* @copyright Copyright (c) 2008
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
/**
|
22 |
* Grid checkbox column renderer
|
23 |
*
|
24 |
-
* @category
|
25 |
-
* @package
|
26 |
-
* @author
|
27 |
*/
|
28 |
class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
{
|
@@ -73,6 +73,8 @@ class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Admi
|
|
73 |
$val = $row->$getter();
|
74 |
}
|
75 |
$val = $val2 = $row->getData($this->getColumn()->getIndex());
|
|
|
|
|
76 |
$url = Mage::helper('enhancedgrid')->getImageUrl($val);
|
77 |
|
78 |
if(!Mage::helper('enhancedgrid')->getFileExists($val)) {
|
@@ -91,12 +93,19 @@ class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Admi
|
|
91 |
$val = "<span>". $filename ."</span>";
|
92 |
}
|
93 |
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
if(self::$showByDefault) {
|
98 |
$out .= "<img src=". $url ." width='". self::$width ."' ";
|
99 |
-
|
|
|
|
|
|
|
100 |
}
|
101 |
//die( $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135));
|
102 |
$out .= '</a></center>';
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WDCA
|
4 |
*
|
5 |
* NOTICE OF LICENSE
|
6 |
*
|
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 |
+
* @category WDCA
|
16 |
+
* @package TBT_Enhancedgrid
|
17 |
+
* @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
|
18 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
*/
|
20 |
|
21 |
/**
|
22 |
* Grid checkbox column renderer
|
23 |
*
|
24 |
+
* @category WDCA
|
25 |
+
* @package TBT_Enhancedgrid
|
26 |
+
* @author WDCA <contact@wdca.ca>
|
27 |
*/
|
28 |
class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
{
|
73 |
$val = $row->$getter();
|
74 |
}
|
75 |
$val = $val2 = $row->getData($this->getColumn()->getIndex());
|
76 |
+
$val = str_replace("no_selection", "", $val);
|
77 |
+
$val2 = str_replace("no_selection", "", $val2);
|
78 |
$url = Mage::helper('enhancedgrid')->getImageUrl($val);
|
79 |
|
80 |
if(!Mage::helper('enhancedgrid')->getFileExists($val)) {
|
93 |
$val = "<span>". $filename ."</span>";
|
94 |
}
|
95 |
|
96 |
+
if(empty($val2) ) {
|
97 |
+
$out = "<center>" . $this->__("(no image)") . "</center>";
|
98 |
+
} else {
|
99 |
+
$out = $val. '<center><a href="#" onclick="window.open(\''. $url .'\', \''. $val2 .'\')"'.
|
100 |
+
'title="'. $val2 .'" '. ' url="'.$url.'" id="imageurl">';
|
101 |
+
}
|
102 |
|
103 |
+
if(self::$showByDefault && !empty($val2) ) {
|
104 |
$out .= "<img src=". $url ." width='". self::$width ."' ";
|
105 |
+
if(self::$height > self::$width) {
|
106 |
+
$out .= "height='". self::$height ."' ";
|
107 |
+
}
|
108 |
+
$out .=" />";
|
109 |
}
|
110 |
//die( $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135));
|
111 |
$out .= '</a></center>';
|
app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Columns/Show.php
CHANGED
@@ -1,5 +1,30 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
class TBT_Enhancedgrid_Model_System_Config_Source_Columns_Show
|
4 |
{
|
5 |
public function toOptionArray()
|
@@ -7,7 +32,7 @@ class TBT_Enhancedgrid_Model_System_Config_Source_Columns_Show
|
|
7 |
|
8 |
$collection = Mage::getResourceModel('eav/entity_attribute_collection')
|
9 |
->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )
|
10 |
-
->
|
11 |
$cols = array();
|
12 |
$cols[] = array('value' => 'id', 'label' => 'ID');
|
13 |
$cols[] = array('value' => 'type_id', 'label' => 'Type (simple, bundle, etc)');
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* WDCA
|
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 |
+
* @category WDCA
|
16 |
+
* @package TBT_Enhancedgrid
|
17 |
+
* @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
|
18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
19 |
+
*/
|
20 |
|
21 |
+
/**
|
22 |
+
* Grid checkbox column renderer
|
23 |
+
*
|
24 |
+
* @category WDCA
|
25 |
+
* @package TBT_Enhancedgrid
|
26 |
+
* @author WDCA <contact@wdca.ca>
|
27 |
+
*/
|
28 |
class TBT_Enhancedgrid_Model_System_Config_Source_Columns_Show
|
29 |
{
|
30 |
public function toOptionArray()
|
32 |
|
33 |
$collection = Mage::getResourceModel('eav/entity_attribute_collection')
|
34 |
->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )
|
35 |
+
->addFilter("is_visible", 1);
|
36 |
$cols = array();
|
37 |
$cols[] = array('value' => 'id', 'label' => 'ID');
|
38 |
$cols[] = array('value' => 'type_id', 'label' => 'Type (simple, bundle, etc)');
|
app/code/community/TBT/Enhancedgrid/etc/system.xml
CHANGED
@@ -3,14 +3,13 @@
|
|
3 |
|
4 |
<tabs>
|
5 |
<tbtall translate="label" module="enhancedgrid">
|
6 |
-
<label>
|
7 |
<sort_order>100</sort_order>
|
8 |
</tbtall>
|
9 |
</tabs>
|
10 |
<sections>
|
11 |
<enhancedgrid translate="label" module="enhancedgrid">
|
12 |
<label>Enhanced Product Grid</label>
|
13 |
-
<comment>This extension was developed by Trade Business Technology Corp. For customization </comment>
|
14 |
<tab>tbtall</tab>
|
15 |
<frontend_type>text</frontend_type>
|
16 |
<sort_order>10</sort_order>
|
@@ -18,12 +17,12 @@
|
|
18 |
<show_in_website>1</show_in_website>
|
19 |
<show_in_store>0</show_in_store>
|
20 |
<groups>
|
21 |
-
<
|
22 |
-
<label>
|
23 |
-
<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>
|
@@ -32,7 +31,15 @@
|
|
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>
|
@@ -64,7 +71,7 @@
|
|
64 |
<show_in_default>1</show_in_default>
|
65 |
<show_in_website>1</show_in_website>
|
66 |
<fields>
|
67 |
-
<showurl translate="label">
|
68 |
<label>Show Image Url</label>
|
69 |
<comment>(When product image is hidden for that row)</comment>
|
70 |
<frontend_type>select</frontend_type>
|
@@ -73,7 +80,7 @@
|
|
73 |
<show_in_default>1</show_in_default>
|
74 |
<show_in_website>1</show_in_website>
|
75 |
</showurl>
|
76 |
-
<showbydefault translate="label">
|
77 |
<label>Show Image By Default</label>
|
78 |
<comment>If your grid has a large page size by default this could get slow.</comment>
|
79 |
<frontend_type>select</frontend_type>
|
@@ -82,14 +89,14 @@
|
|
82 |
<show_in_default>1</show_in_default>
|
83 |
<show_in_website>1</show_in_website>
|
84 |
</showbydefault>
|
85 |
-
<width translate="label">
|
86 |
<label>Image Width</label>
|
87 |
<frontend_type>text</frontend_type>
|
88 |
<sort_order>30</sort_order>
|
89 |
<show_in_default>1</show_in_default>
|
90 |
<show_in_website>1</show_in_website>
|
91 |
</width>
|
92 |
-
<height translate="label">
|
93 |
<label>Image Height</label>
|
94 |
<frontend_type>text</frontend_type>
|
95 |
<sort_order>40</sort_order>
|
@@ -118,7 +125,7 @@
|
|
118 |
<show_in_default>1</show_in_default>
|
119 |
<show_in_website>1</show_in_website>
|
120 |
</page>
|
121 |
-
<sort translate="label">
|
122 |
<label>Sort Column</label>
|
123 |
<comment>The selected column must be also selected above if it's not already there</comment>
|
124 |
<frontend_type>select</frontend_type>
|
3 |
|
4 |
<tabs>
|
5 |
<tbtall translate="label" module="enhancedgrid">
|
6 |
+
<label>WDCA Extensions</label>
|
7 |
<sort_order>100</sort_order>
|
8 |
</tbtall>
|
9 |
</tabs>
|
10 |
<sections>
|
11 |
<enhancedgrid translate="label" module="enhancedgrid">
|
12 |
<label>Enhanced Product Grid</label>
|
|
|
13 |
<tab>tbtall</tab>
|
14 |
<frontend_type>text</frontend_type>
|
15 |
<sort_order>10</sort_order>
|
17 |
<show_in_website>1</show_in_website>
|
18 |
<show_in_store>0</show_in_store>
|
19 |
<groups>
|
20 |
+
<about translate="label">
|
21 |
+
<label>About This Extension</label>
|
22 |
+
<sort_order>100</sort_order>
|
23 |
<show_in_default>1</show_in_default>
|
24 |
<show_in_website>1</show_in_website>
|
25 |
+
<fields>
|
26 |
<notice translate="label">
|
27 |
<label>Extension Information Provided By WWW.WDCA.CA</label>
|
28 |
<frontend_type>text</frontend_type>
|
31 |
<show_in_default>1</show_in_default>
|
32 |
<show_in_website>1</show_in_website>
|
33 |
<show_in_store>1</show_in_store>
|
34 |
+
</notice>
|
35 |
+
</fields>
|
36 |
+
</about>
|
37 |
+
<columns translate="label">
|
38 |
+
<label>Column Options</label>
|
39 |
+
<sort_order>200</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<fields>
|
43 |
<showcolumns translate="label">
|
44 |
<label>Show Columns</label>
|
45 |
<frontend_type>multiselect</frontend_type>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>1</show_in_website>
|
73 |
<fields>
|
74 |
+
<showurl translate="label comment">
|
75 |
<label>Show Image Url</label>
|
76 |
<comment>(When product image is hidden for that row)</comment>
|
77 |
<frontend_type>select</frontend_type>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>1</show_in_website>
|
82 |
</showurl>
|
83 |
+
<showbydefault translate="label comment">
|
84 |
<label>Show Image By Default</label>
|
85 |
<comment>If your grid has a large page size by default this could get slow.</comment>
|
86 |
<frontend_type>select</frontend_type>
|
89 |
<show_in_default>1</show_in_default>
|
90 |
<show_in_website>1</show_in_website>
|
91 |
</showbydefault>
|
92 |
+
<width translate="label comment">
|
93 |
<label>Image Width</label>
|
94 |
<frontend_type>text</frontend_type>
|
95 |
<sort_order>30</sort_order>
|
96 |
<show_in_default>1</show_in_default>
|
97 |
<show_in_website>1</show_in_website>
|
98 |
</width>
|
99 |
+
<height translate="label comment">
|
100 |
<label>Image Height</label>
|
101 |
<frontend_type>text</frontend_type>
|
102 |
<sort_order>40</sort_order>
|
125 |
<show_in_default>1</show_in_default>
|
126 |
<show_in_website>1</show_in_website>
|
127 |
</page>
|
128 |
+
<sort translate="label comment">
|
129 |
<label>Sort Column</label>
|
130 |
<comment>The selected column must be also selected above if it's not already there</comment>
|
131 |
<frontend_type>select</frontend_type>
|
app/design/adminhtml/default/default/layout/tbt_enhancedgrid.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
/**
|
4 |
-
*
|
5 |
*
|
6 |
* NOTICE OF LICENSE
|
7 |
*
|
@@ -13,27 +13,30 @@
|
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* versions in the future. If you wish to customize Magento for your
|
20 |
-
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
-
*
|
22 |
-
* @category improvedsearch
|
23 |
-
* @package TBT_Improvedsearch
|
24 |
-
* @copyright Copyright (c) 2008 Trade Business Technology Corp.
|
25 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
26 |
*/
|
27 |
-
|
28 |
-->
|
29 |
<layout>
|
30 |
<default>
|
31 |
<reference name="head">
|
32 |
<!--action method="removeItem"><type>js</type><name>mage/adminhtml/grid.js</name></action-->
|
33 |
-
<action method="addJs"><script>tbt/enhancedgrid/enhancedgrid.js</script></action>
|
34 |
-
<action method="addJs"><script>tbt/enhancedgrid/egsupplemental.js</script></action>
|
35 |
-
<action method="addJs"><script>tbt/enhancedgrid/customfunctions/catalog_products.js</script></action>
|
36 |
-
<action method="addItem"><type>js_css</type><name>tbt/enhancedgrid/resources/css/enhancedgrid.css</name></action>
|
37 |
</reference>
|
38 |
</default>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<!--
|
3 |
/**
|
4 |
+
* WDCA
|
5 |
*
|
6 |
* NOTICE OF LICENSE
|
7 |
*
|
13 |
* obtain it through the world-wide-web, please send an email
|
14 |
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
*
|
16 |
+
* @category WDCA
|
17 |
+
* @package TBT_Enhancedgrid
|
18 |
+
* @copyright Copyright (c) 2008-2010 WDCA (http://www.wdca.ca)
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
|
|
21 |
-->
|
22 |
<layout>
|
23 |
<default>
|
24 |
<reference name="head">
|
25 |
<!--action method="removeItem"><type>js</type><name>mage/adminhtml/grid.js</name></action-->
|
26 |
+
<action method="addJs" ifconfig="enhancedgrid/general/isenabled"><script>tbt/enhancedgrid/enhancedgrid.js</script></action>
|
27 |
+
<action method="addJs" ifconfig="enhancedgrid/general/isenabled"><script>tbt/enhancedgrid/egsupplemental.js</script></action>
|
28 |
+
<action method="addJs" ifconfig="enhancedgrid/general/isenabled"><script>tbt/enhancedgrid/customfunctions/catalog_products.js</script></action>
|
29 |
+
<action method="addItem" ifconfig="enhancedgrid/general/isenabled"><type>js_css</type><name>tbt/enhancedgrid/resources/css/enhancedgrid.css</name></action>
|
30 |
</reference>
|
31 |
</default>
|
32 |
+
<adminhtml_catalog_product_index>
|
33 |
+
<reference name="content">
|
34 |
+
<remove name="products_list"/>
|
35 |
+
<block type="enhancedgrid/catalog_product" name="enhanced_products_list" >
|
36 |
+
<block type="adminhtml/store_switcher" name="store_switcher" as="store_switcher">
|
37 |
+
<action method="setUseConfirm"><params>0</params></action>
|
38 |
+
</block>
|
39 |
+
</block>
|
40 |
+
</reference>
|
41 |
+
</adminhtml_catalog_product_index>
|
42 |
</layout>
|
package.xml
CHANGED
@@ -1,18 +1,23 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TBT_Enhancedgrid</name>
|
4 |
-
<version>1.
|
5 |
-
<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>-
|
|
|
|
|
|
|
|
|
|
|
12 |
<authors><author><name>Jay</name><user>auto-converted</user><email>najibkaake@gmail.com</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>TBT_Enhancedgrid</name>
|
4 |
+
<version>1.2</version>
|
5 |
+
<stability>beta</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>- Added Magento 1.4 compatibility
|
12 |
+
- Made images in the grid maintain their proportions when the height attribute is smaller than or equal to the weight attribute as configured in the back-end image display config for the grid.
|
13 |
+
- Now rewrites Magento's existing product grid. To turn off Enhanced Product Grid modify the app/etc/modules/TBT_Enhancedgrid.cml file and set the 'active' value to 'false'
|
14 |
+
- Fixed a column spacing issue that would even out the columns. Now the NAME column takes any remaining column space.
|
15 |
+
- Removed some unneeded files.
|
16 |
+
- Changed the structure of the configuration section</notes>
|
17 |
<authors><author><name>Jay</name><user>auto-converted</user><email>najibkaake@gmail.com</email></author></authors>
|
18 |
+
<date>2010-02-10</date>
|
19 |
+
<time>22:55:29</time>
|
20 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="5ea7808543f767bbf8e148d1352cb103"/></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="76cf8eddad9dc1d126c27d66ee4ba3b5"/></dir><file name="Product.php" hash="a6348f1f8ce10e628fb27537a659fafb"/></dir><dir name="System"><file name="Html.php" hash="45e5f2264b741206c09c67ae8099d0f1"/></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="ddac5ed4cc015c4dd256f172c802e9cf"/></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="e08e8e8341ba013c32386933675090b4"/><file name="system.xml" hash="8701ce4222932d3ba031168ef4681c95"/></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="df3eab7cdd33838618dee173bd890fe7"/></dir><dir name="Sort"><file name="Direction.php" hash="23cb37d1af2dd75c3c9537adf90c1bc8"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
21 |
<compatible/>
|
22 |
<dependencies/>
|
23 |
</package>
|