Version Notes
First beta release.
Download this release
Release Info
| Developer | Magento Core Team |
| Extension | TBT_Enhancedgrid |
| Version | 1.0 |
| Comparing to | |
| See all releases | |
Version 1.0
- app/code/community/TBT/Enhancedgrid/Block/Catalog/Product.php +50 -0
- app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php +522 -0
- app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column.php +58 -0
- app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Filter/Image.php +31 -0
- app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Action.php +77 -0
- app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php +109 -0
- app/code/community/TBT/Enhancedgrid/Helper/Data.php +33 -0
- app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Columns/Show.php +22 -0
- app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Sort/Direction.php +12 -0
- app/code/community/TBT/Enhancedgrid/controllers/Catalog/ProductController.php +154 -0
- app/code/community/TBT/Enhancedgrid/etc/config.xml +126 -0
- app/code/community/TBT/Enhancedgrid/etc/system.xml +173 -0
- app/design/adminhtml/default/default/layout/tbt_enhancedgrid.xml +39 -0
- app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product.phtml +40 -0
- app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product/grid.phtml +192 -0
- app/etc/modules/TBT_Enhancedgrid.xml +9 -0
- js/tbt/enhancedgrid/customfunctions/catalog_products.js +97 -0
- js/tbt/enhancedgrid/egsupplemental.js +56 -0
- js/tbt/enhancedgrid/enhancedgrid.js +356 -0
- js/tbt/enhancedgrid/resources/css/enhancedgrid.css +2 -0
- package.xml +18 -0
app/code/community/TBT/Enhancedgrid/Block/Catalog/Product.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* Catalog manage products 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 extends Mage_Adminhtml_Block_Catalog_Product
|
| 35 |
+
{
|
| 36 |
+
|
| 37 |
+
public function __construct()
|
| 38 |
+
{
|
| 39 |
+
parent::__construct();
|
| 40 |
+
$this->_headerText = Mage::helper('enhancedgrid')->__('Manage Products (Enhanced)');
|
| 41 |
+
|
| 42 |
+
}
|
| 43 |
+
protected function _prepareLayout()
|
| 44 |
+
{
|
| 45 |
+
parent::_prepareLayout();
|
| 46 |
+
$this->setTemplate('tbt/enhancedgrid/catalog/product.phtml');
|
| 47 |
+
$this->setChild('grid', $this->getLayout()->createBlock('enhancedgrid/catalog_product_grid', 'product.enhancedgrid'));
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
app/code/community/TBT/Enhancedgrid/Block/Catalog/Product/Grid.php
ADDED
|
@@ -0,0 +1,522 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 $isenabled = true;
|
| 39 |
+
|
| 40 |
+
public function __construct()
|
| 41 |
+
{
|
| 42 |
+
parent::__construct();
|
| 43 |
+
$this->isenabled = Mage::getStoreConfig('enhancedgrid/general/isenabled');
|
| 44 |
+
|
| 45 |
+
$this->setId('productGrid');
|
| 46 |
+
|
| 47 |
+
$this->prepareDefaults();
|
| 48 |
+
|
| 49 |
+
$this->setSaveParametersInSession(true);
|
| 50 |
+
$this->setUseAjax(true);
|
| 51 |
+
$this->setVarNameFilter('product_filter');
|
| 52 |
+
|
| 53 |
+
$this->prepareColumnSettings();
|
| 54 |
+
$this->setTemplate('tbt/enhancedgrid/catalog/product/grid.phtml');
|
| 55 |
+
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
private function prepareDefaults() {
|
| 59 |
+
$this->setDefaultLimit(Mage::getStoreConfig('enhancedgrid/griddefaults/limit'));
|
| 60 |
+
$this->setDefaultPage(Mage::getStoreConfig('enhancedgrid/griddefaults/page'));
|
| 61 |
+
$this->setDefaultSort(Mage::getStoreConfig('enhancedgrid/griddefaults/sort'));
|
| 62 |
+
$this->setDefaultDir(Mage::getStoreConfig('enhancedgrid/griddefaults/dir'));
|
| 63 |
+
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
private function prepareColumnSettings() {
|
| 67 |
+
$storeSettings = Mage::getStoreConfig('enhancedgrid/columns/showcolumns');
|
| 68 |
+
|
| 69 |
+
$tempArr = explode(',', $storeSettings);
|
| 70 |
+
|
| 71 |
+
foreach($tempArr as $showCol) {
|
| 72 |
+
$this->columnSettings[trim($showCol)] = true;
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
public function colIsVisible($code) {
|
| 77 |
+
return isset($this->columnSettings[$code]);
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
protected function _prepareLayout()
|
| 81 |
+
{
|
| 82 |
+
$this->setChild('export_button',
|
| 83 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
| 84 |
+
->setData(array(
|
| 85 |
+
'label' => Mage::helper('adminhtml')->__('Export'),
|
| 86 |
+
'onclick' => $this->getJsObjectName().'.doExport()',
|
| 87 |
+
'class' => 'task'
|
| 88 |
+
))
|
| 89 |
+
);
|
| 90 |
+
$this->setChild('reset_filter_button',
|
| 91 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
| 92 |
+
->setData(array(
|
| 93 |
+
'label' => Mage::helper('adminhtml')->__('Reset Filter'),
|
| 94 |
+
'onclick' => $this->getJsObjectName().'.resetFilter()',
|
| 95 |
+
))
|
| 96 |
+
);
|
| 97 |
+
$this->setChild('search_button',
|
| 98 |
+
$this->getLayout()->createBlock('adminhtml/widget_button')
|
| 99 |
+
->setData(array(
|
| 100 |
+
'label' => Mage::helper('adminhtml')->__('Search'),
|
| 101 |
+
'onclick' => $this->getJsObjectName().'.doFilter()',
|
| 102 |
+
'class' => 'task'
|
| 103 |
+
))
|
| 104 |
+
);
|
| 105 |
+
return parent::_prepareLayout();
|
| 106 |
+
}
|
| 107 |
+
public function getQueryStr() {
|
| 108 |
+
return urldecode($this->getParam('q'));
|
| 109 |
+
}
|
| 110 |
+
protected function _prepareCollection()
|
| 111 |
+
{
|
| 112 |
+
$collection = $this->getCollection();
|
| 113 |
+
if($queryString = $this->getQueryStr()) {
|
| 114 |
+
$collection = Mage::Helper('enhancedgrid')
|
| 115 |
+
->getSearchCollection($queryString, $this->getRequest());
|
| 116 |
+
}
|
| 117 |
+
if(!$collection) {
|
| 118 |
+
$collection = Mage::getModel('catalog/product')->getCollection();
|
| 119 |
+
}
|
| 120 |
+
$store = $this->_getStore();
|
| 121 |
+
$collection
|
| 122 |
+
->joinField('qty',
|
| 123 |
+
'cataloginventory/stock_item',
|
| 124 |
+
'qty',
|
| 125 |
+
'product_id=entity_id',
|
| 126 |
+
'{{table}}.stock_id=1',
|
| 127 |
+
'left');
|
| 128 |
+
$collection->addAttributeToSelect('sku');
|
| 129 |
+
|
| 130 |
+
//$collection->addAttributeToSelect('attribute_set_id');
|
| 131 |
+
//$collection->addAttributeToSelect('type_id');
|
| 132 |
+
//$collection->addAttributeToSelect('image'); // TODO remove this
|
| 133 |
+
|
| 134 |
+
if ($store->getId()) {
|
| 135 |
+
//$collection->setStoreId($store->getId());
|
| 136 |
+
$collection->addStoreFilter($store);
|
| 137 |
+
$collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId());
|
| 138 |
+
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId());
|
| 139 |
+
$collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId());
|
| 140 |
+
$collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId());
|
| 141 |
+
}
|
| 142 |
+
else {
|
| 143 |
+
$collection->addAttributeToSelect('price');
|
| 144 |
+
$collection->addAttributeToSelect('status');
|
| 145 |
+
$collection->addAttributeToSelect('visibility');
|
| 146 |
+
}
|
| 147 |
+
// EG: Select all needed columns.
|
| 148 |
+
//id,name,type,attribute_set,sku,price,qty,visibility,status,websites,image
|
| 149 |
+
foreach($this->columnSettings as $col => $true) {
|
| 150 |
+
if($col == 'qty' || $col == 'websites' || $col=='id') continue;
|
| 151 |
+
$collection->addAttributeToSelect($col);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
$this->setCollection($collection);
|
| 155 |
+
|
| 156 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
|
| 157 |
+
$this->addExportType('*/*/exportXml', Mage::helper('customer')->__('XML'));
|
| 158 |
+
|
| 159 |
+
parent::_prepareCollection();
|
| 160 |
+
$collection->addWebsiteNamesToResult();
|
| 161 |
+
|
| 162 |
+
return $this;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
protected function _getStore()
|
| 167 |
+
{
|
| 168 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
| 169 |
+
return Mage::app()->getStore($storeId);
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
protected function _addColumnFilterToCollection($column)
|
| 174 |
+
{
|
| 175 |
+
if ($this->getCollection()) {
|
| 176 |
+
if ($column->getId() == 'websites') {
|
| 177 |
+
$this->getCollection()->joinField('websites',
|
| 178 |
+
'catalog/product_website',
|
| 179 |
+
'website_id',
|
| 180 |
+
'product_id=entity_id',
|
| 181 |
+
null,
|
| 182 |
+
'left');
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
return parent::_addColumnFilterToCollection($column);
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
protected function _prepareColumns()
|
| 189 |
+
{
|
| 190 |
+
|
| 191 |
+
if($this->colIsVisible('id')) {
|
| 192 |
+
$this->addColumn('id',
|
| 193 |
+
array(
|
| 194 |
+
'header'=> Mage::helper('catalog')->__('ID'),
|
| 195 |
+
'width' => '50px',
|
| 196 |
+
'type' => 'number',
|
| 197 |
+
'index' => 'entity_id',
|
| 198 |
+
));
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
$imgWidth = Mage::getStoreConfig('enhancedgrid/images/width') + "px";
|
| 202 |
+
|
| 203 |
+
if($this->colIsVisible('thumbnail')) {
|
| 204 |
+
$this->addColumn('thumbnail',
|
| 205 |
+
array(
|
| 206 |
+
'header'=> Mage::helper('catalog')->__('Thumbnail'),
|
| 207 |
+
'type' => 'image',
|
| 208 |
+
'width' => $imgWidth,
|
| 209 |
+
'index' => 'thumbnail',
|
| 210 |
+
));
|
| 211 |
+
}
|
| 212 |
+
if($this->colIsVisible('small_image')) {
|
| 213 |
+
$this->addColumn('small_image',
|
| 214 |
+
array(
|
| 215 |
+
'header'=> Mage::helper('catalog')->__('Small Img'),
|
| 216 |
+
'type' => 'image',
|
| 217 |
+
'width' => $imgWidth,
|
| 218 |
+
'index' => 'small_image',
|
| 219 |
+
));
|
| 220 |
+
}
|
| 221 |
+
if($this->colIsVisible('image')) {
|
| 222 |
+
$this->addColumn('image',
|
| 223 |
+
array(
|
| 224 |
+
'header'=> Mage::helper('catalog')->__('Image'),
|
| 225 |
+
'type' => 'image',
|
| 226 |
+
'width' => $imgWidth,
|
| 227 |
+
'index' => 'image',
|
| 228 |
+
));
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
if($this->colIsVisible('name')) {
|
| 232 |
+
$this->addColumn('name',
|
| 233 |
+
array(
|
| 234 |
+
'header'=> Mage::helper('catalog')->__('Name'),
|
| 235 |
+
'index' => 'name',
|
| 236 |
+
'width' => '150px'
|
| 237 |
+
));
|
| 238 |
+
}
|
| 239 |
+
if($this->colIsVisible('name')) {
|
| 240 |
+
$store = $this->_getStore();
|
| 241 |
+
if ($store->getId()) {
|
| 242 |
+
$this->addColumn('custom_name',
|
| 243 |
+
array(
|
| 244 |
+
'header'=> Mage::helper('catalog')->__('Name In %s', $store->getName()),
|
| 245 |
+
'index' => 'custom_name',
|
| 246 |
+
'width' => '150px'
|
| 247 |
+
));
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
if($this->colIsVisible('type_id')) {
|
| 252 |
+
$this->addColumn('type',
|
| 253 |
+
array(
|
| 254 |
+
'header'=> Mage::helper('catalog')->__('Type'),
|
| 255 |
+
'width' => '60px',
|
| 256 |
+
'index' => 'type_id',
|
| 257 |
+
'type' => 'options',
|
| 258 |
+
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
|
| 259 |
+
));
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
|
| 263 |
+
if($this->colIsVisible('attribute_set_id')) {
|
| 264 |
+
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
|
| 265 |
+
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
|
| 266 |
+
->load()
|
| 267 |
+
->toOptionHash();
|
| 268 |
+
|
| 269 |
+
$this->addColumn('set_name',
|
| 270 |
+
array(
|
| 271 |
+
'header'=> Mage::helper('catalog')->__('Attrib. Set Name'),
|
| 272 |
+
'width' => '100px',
|
| 273 |
+
'index' => 'attribute_set_id',
|
| 274 |
+
'type' => 'options',
|
| 275 |
+
'options' => $sets,
|
| 276 |
+
));
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
if($this->colIsVisible('sku')) {
|
| 280 |
+
$this->addColumn('sku',
|
| 281 |
+
array(
|
| 282 |
+
'header'=> Mage::helper('catalog')->__('SKU'),
|
| 283 |
+
'width' => '80px',
|
| 284 |
+
'index' => 'sku',
|
| 285 |
+
));
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
if($this->colIsVisible('price')) {
|
| 290 |
+
$store = $this->_getStore();
|
| 291 |
+
$this->addColumn('price',
|
| 292 |
+
array(
|
| 293 |
+
'header'=> Mage::helper('catalog')->__('Price'),
|
| 294 |
+
'type' => 'price',
|
| 295 |
+
'currency_code' => $store->getBaseCurrency()->getCode(),
|
| 296 |
+
'index' => 'price',
|
| 297 |
+
));
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
if($this->colIsVisible('qty')) {
|
| 302 |
+
$this->addColumn('qty',
|
| 303 |
+
array(
|
| 304 |
+
'header'=> Mage::helper('catalog')->__('Qty'),
|
| 305 |
+
'width' => '100px',
|
| 306 |
+
'type' => 'number',
|
| 307 |
+
'index' => 'qty',
|
| 308 |
+
));
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
if($this->colIsVisible('visibility')) {
|
| 313 |
+
$this->addColumn('visibility',
|
| 314 |
+
array(
|
| 315 |
+
'header'=> Mage::helper('catalog')->__('Visibility'),
|
| 316 |
+
'width' => '70px',
|
| 317 |
+
'index' => 'visibility',
|
| 318 |
+
'type' => 'options',
|
| 319 |
+
'options' => Mage::getModel('catalog/product_visibility')->getOptionArray(),
|
| 320 |
+
));
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
|
| 324 |
+
if($this->colIsVisible('status')) {
|
| 325 |
+
$this->addColumn('status',
|
| 326 |
+
array(
|
| 327 |
+
'header'=> Mage::helper('catalog')->__('Status'),
|
| 328 |
+
'width' => '70px',
|
| 329 |
+
'index' => 'status',
|
| 330 |
+
'type' => 'options',
|
| 331 |
+
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
|
| 332 |
+
));
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
if($this->colIsVisible('websites')) {
|
| 337 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
| 338 |
+
$this->addColumn('websites',
|
| 339 |
+
array(
|
| 340 |
+
'header'=> Mage::helper('catalog')->__('Websites'),
|
| 341 |
+
'width' => '100px',
|
| 342 |
+
'sortable' => false,
|
| 343 |
+
'index' => 'websites',
|
| 344 |
+
'type' => 'options',
|
| 345 |
+
'options' => Mage::getModel('core/website')->getCollection()->toOptionHash(),
|
| 346 |
+
));
|
| 347 |
+
}
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
// EG: Show all (other) needed columns.
|
| 351 |
+
$ignoreCols = array('id'=>true, 'websites'=>true,'status'=>true,'visibility'=>true,'qty'=>true,
|
| 352 |
+
'price'=>true,'sku'=>true,'attribute_set_id'=>true, 'type_id'=>true,'name'=>true,
|
| 353 |
+
'image'=>true, 'thumbnail' => true, 'small_image'=>true);
|
| 354 |
+
$currency = $store->getBaseCurrency()->getCode();
|
| 355 |
+
$truncate = Mage::getStoreConfig('enhancedgrid/general/truncatelongtextafter');
|
| 356 |
+
$defaults = array(
|
| 357 |
+
'cost' => array('type'=>'price', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Cost'), 'currency_code' => $currency),
|
| 358 |
+
'weight' => array('type'=>'number', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Weight')),
|
| 359 |
+
'url_key' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Url Key')),
|
| 360 |
+
'tier_price' => array('type'=>'price', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Tier Price'), 'currency_code' => $currency),
|
| 361 |
+
'tax_class_id' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Tax Class ID')),
|
| 362 |
+
'special_to_date' => array('type'=>'date', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Spshl TO Date')),
|
| 363 |
+
'special_price' => array('type'=>'price', 'width'=>'30px', 'header'=> Mage::helper('catalog')->__('Special Price'), 'currency_code' => $currency),
|
| 364 |
+
'special_from_date' => array('type'=>'date', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Spshl FROM Date')),
|
| 365 |
+
'color' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Spshl TO Date')),
|
| 366 |
+
'size' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Size')),
|
| 367 |
+
'brand' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Brand')),
|
| 368 |
+
'custom_design' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design')),
|
| 369 |
+
'custom_design_from' => array('type'=>'date', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design FRM')),
|
| 370 |
+
'custom_design_to' => array('type'=>'date', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Custom Design TO')),
|
| 371 |
+
'default_category_id' => array('type'=>'text', 'width'=>'70px', 'header'=> Mage::helper('catalog')->__('Default Categry ID')),
|
| 372 |
+
'dimension' => array('type'=>'text', 'width'=>'75px', 'header'=> Mage::helper('catalog')->__('Dimensions')),
|
| 373 |
+
'manufacturer' => array('type'=>'text', 'width'=>'75px', 'header'=> Mage::helper('catalog')->__('Manufacturer')),
|
| 374 |
+
'meta_keyword' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Meta Keywds')),
|
| 375 |
+
'meta_description' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Meta Descr')),
|
| 376 |
+
'meta_title' => array('type'=>'text', 'width'=>'100px', 'header'=> Mage::helper('catalog')->__('Meta Title')),
|
| 377 |
+
'short_description' => array('type'=>'text', 'width'=>'150px', 'header'=> Mage::helper('catalog')->__('Short Description'), 'string_limit'=>$truncate),
|
| 378 |
+
'description' => array('type'=>'text', 'width'=>'200px', 'header'=> Mage::helper('catalog')->__('Description'), 'string_limit'=>$truncate)
|
| 379 |
+
);
|
| 380 |
+
//id,name,type,attribute_set,sku,price,qty,visibility,status,websites,image
|
| 381 |
+
foreach($this->columnSettings as $col => $true) {
|
| 382 |
+
if(isset($ignoreCols[$col])) continue;
|
| 383 |
+
if(isset($defaults[$col])) {
|
| 384 |
+
$innerSettings = $defaults[$col];
|
| 385 |
+
} else {
|
| 386 |
+
$innerSettings = array(
|
| 387 |
+
'header'=> Mage::helper('catalog')->__($col),
|
| 388 |
+
'width' => '100px',
|
| 389 |
+
'type' => 'text',
|
| 390 |
+
);
|
| 391 |
+
}
|
| 392 |
+
$innerSettings['index'] = $col;
|
| 393 |
+
$this->addColumn($col, $innerSettings);
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
$this->addColumn('action',
|
| 397 |
+
array(
|
| 398 |
+
'header' => Mage::helper('catalog')->__('Action'),
|
| 399 |
+
'width' => '50px',
|
| 400 |
+
'type' => 'action',
|
| 401 |
+
'getter' => 'getId',
|
| 402 |
+
'actions' => array(
|
| 403 |
+
array(
|
| 404 |
+
'caption' => Mage::helper('catalog')->__('Edit'),
|
| 405 |
+
'id' => "editlink",
|
| 406 |
+
'url' => array(
|
| 407 |
+
'base'=>'adminhtml/*/edit',
|
| 408 |
+
'params'=>array('store'=>$this->getRequest()->getParam('store'))
|
| 409 |
+
),
|
| 410 |
+
'field' => 'id'
|
| 411 |
+
)
|
| 412 |
+
),
|
| 413 |
+
'filter' => false,
|
| 414 |
+
'sortable' => false,
|
| 415 |
+
'index' => 'stores',
|
| 416 |
+
));
|
| 417 |
+
|
| 418 |
+
$this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS'));
|
| 419 |
+
|
| 420 |
+
return parent::_prepareColumns();
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
protected function _prepareMassaction()
|
| 424 |
+
{
|
| 425 |
+
$this->setMassactionIdField('entity_id');
|
| 426 |
+
$this->getMassactionBlock()->setFormFieldName('product');
|
| 427 |
+
|
| 428 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 429 |
+
'label'=> Mage::helper('catalog')->__('Delete'),
|
| 430 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 431 |
+
'confirm' => Mage::helper('catalog')->__('Are you sure?')
|
| 432 |
+
));
|
| 433 |
+
|
| 434 |
+
$statuses = Mage::getSingleton('catalog/product_status')->getOptionArray();
|
| 435 |
+
|
| 436 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
| 437 |
+
$this->getMassactionBlock()->addItem('status', array(
|
| 438 |
+
'label'=> Mage::helper('catalog')->__('Change status'),
|
| 439 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
| 440 |
+
'additional' => array(
|
| 441 |
+
'visibility' => array(
|
| 442 |
+
'name' => 'status',
|
| 443 |
+
'type' => 'select',
|
| 444 |
+
'class' => 'required-entry',
|
| 445 |
+
'label' => Mage::helper('catalog')->__('Status'),
|
| 446 |
+
'values' => $statuses
|
| 447 |
+
)
|
| 448 |
+
)
|
| 449 |
+
));
|
| 450 |
+
|
| 451 |
+
$this->getMassactionBlock()->addItem('attributes', array(
|
| 452 |
+
'label' => Mage::helper('catalog')->__('Update attributes'),
|
| 453 |
+
'url' => $this->getUrl('*/catalog_product_action_attribute/edit', array('_current'=>true))
|
| 454 |
+
));
|
| 455 |
+
|
| 456 |
+
|
| 457 |
+
// Divider
|
| 458 |
+
$this->getMassactionBlock()->addItem('imagesDivider', $this->getMADivider("Images"));
|
| 459 |
+
|
| 460 |
+
// Show images...
|
| 461 |
+
$this->getMassactionBlock()->addItem('showImages', array(
|
| 462 |
+
'label' => $this->__('Show Selected Images'),
|
| 463 |
+
'url' => $this->getUrl('*/*/index', array('_current'=>true)),
|
| 464 |
+
'callback' => 'showSelectedImages(productGrid_massactionJsObject, '
|
| 465 |
+
.'{checkedValues}, \'<img src=\\\'{imgurl}\\\' width=50 height=50 border=0 />\')'
|
| 466 |
+
|
| 467 |
+
));
|
| 468 |
+
// Hide Images
|
| 469 |
+
$this->getMassactionBlock()->addItem('hideImages', array(
|
| 470 |
+
'label' => $this->__('Hide Selected Images'),
|
| 471 |
+
'url' => $this->getUrl('*/*/index', array('_current'=>true)),
|
| 472 |
+
'callback' => 'hideSelectedImages(productGrid_massactionJsObject, {checkedValues})'
|
| 473 |
+
|
| 474 |
+
));
|
| 475 |
+
|
| 476 |
+
// Divider 3
|
| 477 |
+
$this->getMassactionBlock()->addItem('otherDivider', $this->getMADivider("Other"));
|
| 478 |
+
|
| 479 |
+
// Opens all products
|
| 480 |
+
|
| 481 |
+
// Refresh...
|
| 482 |
+
$this->getMassactionBlock()->addItem('refreshProducts', array(
|
| 483 |
+
'label' => $this->__('Refresh Products'),
|
| 484 |
+
'url' => $this->getUrl('*/*/massRefreshProducts', array('_current'=>true))
|
| 485 |
+
));
|
| 486 |
+
|
| 487 |
+
// $this->getMassactionBlock()->addItem('saveEditables', array(
|
| 488 |
+
// 'label' => $this->__('SAVE EDITABLES'),
|
| 489 |
+
// 'url' => $this->getUrl('*/*/saveEditables', array('_current'=>true)),
|
| 490 |
+
// 'fields' => array('short_description2', '')
|
| 491 |
+
// ));
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
return $this;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
|
| 498 |
+
public function getRowUrl($row)
|
| 499 |
+
{
|
| 500 |
+
return $this->getUrl('adminhtml/catalog_product/edit', array(
|
| 501 |
+
'store'=>$this->getRequest()->getParam('store'),
|
| 502 |
+
'id'=>$row->getId())
|
| 503 |
+
);
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
public function getGridUrl()
|
| 507 |
+
{
|
| 508 |
+
return $this->getUrl('*/*/grid', array('_current'=>true));
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
protected function getMADivider($dividerHeading="-------") {
|
| 514 |
+
$dividerTemplate = array(
|
| 515 |
+
'label' => '--------'.$this->__($dividerHeading).'--------',
|
| 516 |
+
'url' => $this->getUrl('*/*/index', array('_current'=>true)),
|
| 517 |
+
'callback' => "null"
|
| 518 |
+
);
|
| 519 |
+
return $dividerTemplate;
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
}
|
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column.php
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* @category Mage
|
| 16 |
+
* @package TBT_MassRelater
|
| 17 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Grid column block
|
| 23 |
+
*
|
| 24 |
+
* @category Mage
|
| 25 |
+
* @package TBT_MassRelater
|
| 26 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 27 |
+
*/
|
| 28 |
+
class TBT_Enhancedgrid_Block_Widget_Grid_Column extends Mage_Adminhtml_Block_Widget_Grid_Column
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
protected function _getRendererByType()
|
| 33 |
+
{
|
| 34 |
+
switch (strtolower($this->getType())) {
|
| 35 |
+
case 'image':
|
| 36 |
+
$rendererClass = 'enhancedgrid/widget_grid_column_renderer_image';
|
| 37 |
+
break;
|
| 38 |
+
default:
|
| 39 |
+
$rendererClass = parent::_getRendererByType();
|
| 40 |
+
break;
|
| 41 |
+
}
|
| 42 |
+
return $rendererClass;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
protected function _getFilterByType()
|
| 46 |
+
{
|
| 47 |
+
switch (strtolower($this->getType())) {
|
| 48 |
+
case 'image':
|
| 49 |
+
$filterClass = 'enhancedgrid/widget_grid_column_filter_image';
|
| 50 |
+
break;
|
| 51 |
+
default:
|
| 52 |
+
$filterClass = parent::_getFilterByType();
|
| 53 |
+
break;
|
| 54 |
+
}
|
| 55 |
+
return $filterClass;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
}
|
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Filter/Image.php
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* @category Mage
|
| 16 |
+
* @package TBT_MassRelater
|
| 17 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Checkbox grid column filter
|
| 23 |
+
*
|
| 24 |
+
* @category Mage
|
| 25 |
+
* @package TBT_MassRelater
|
| 26 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 27 |
+
*/
|
| 28 |
+
class TBT_Enhancedgrid_Block_Widget_Grid_Column_Filter_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Text
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
}
|
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Action.php
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* @category Mage
|
| 16 |
+
* @package TBT_MassRelater
|
| 17 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 18 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 19 |
+
*/
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Grid column widget for rendering action grid cells
|
| 23 |
+
*
|
| 24 |
+
* @category Mage
|
| 25 |
+
* @package TBT_MassRelater
|
| 26 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 27 |
+
*/
|
| 28 |
+
class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
| 29 |
+
{
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Prepares action data for html render
|
| 33 |
+
*
|
| 34 |
+
* @param array $action
|
| 35 |
+
* @param string $actionCaption
|
| 36 |
+
* @param Varien_Object $row
|
| 37 |
+
* @return Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
| 38 |
+
*/
|
| 39 |
+
protected function _transformActionData(&$action, &$actionCaption, Varien_Object $row)
|
| 40 |
+
{
|
| 41 |
+
foreach ( $action as $attibute => $value ) {
|
| 42 |
+
if(isset($action[$attibute]) && !is_array($action[$attibute])) {
|
| 43 |
+
$this->getColumn()->setFormat($action[$attibute]);
|
| 44 |
+
$action[$attibute] = parent::render($row);
|
| 45 |
+
} else {
|
| 46 |
+
$this->getColumn()->setFormat(null);
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
switch ($attibute) {
|
| 50 |
+
case 'caption':
|
| 51 |
+
$actionCaption = $action['caption'];
|
| 52 |
+
unset($action['caption']);
|
| 53 |
+
break;
|
| 54 |
+
|
| 55 |
+
case 'url':
|
| 56 |
+
if(is_array($action['url'])) {
|
| 57 |
+
$params = array($action['field']=>$this->_getValue($row));
|
| 58 |
+
if(isset($action['url']['params'])) {
|
| 59 |
+
$params = array_merge($action['url']['params'], $params);
|
| 60 |
+
}
|
| 61 |
+
$action['href'] = $this->getUrl($action['url']['base'], $params);
|
| 62 |
+
unset($action['field']);
|
| 63 |
+
} else {
|
| 64 |
+
$action['href'] = $action['url'];
|
| 65 |
+
}
|
| 66 |
+
unset($action['url']);
|
| 67 |
+
break;
|
| 68 |
+
|
| 69 |
+
case 'popup':
|
| 70 |
+
$action['onclick'] = 'popWin(this.href, \'windth=800,height=700,resizable=1,scrollbars=1\');return false;';
|
| 71 |
+
break;
|
| 72 |
+
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
return $this;
|
| 76 |
+
}
|
| 77 |
+
}
|
app/code/community/TBT/Enhancedgrid/Block/Widget/Grid/Column/Renderer/Image.php
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* @category Mage
|
| 16 |
+
* @package TBT_MassRelater
|
| 17 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 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 Mage
|
| 25 |
+
* @package TBT_MassRelater
|
| 26 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 27 |
+
*/
|
| 28 |
+
class TBT_Enhancedgrid_Block_Widget_Grid_Column_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
| 29 |
+
{
|
| 30 |
+
protected static $showImagesUrl = null;
|
| 31 |
+
protected static $showByDefault = null;
|
| 32 |
+
protected static $width = null;
|
| 33 |
+
protected static $height = null;
|
| 34 |
+
|
| 35 |
+
public function __construct() {
|
| 36 |
+
if(self::$showImagesUrl == null)
|
| 37 |
+
self::$showImagesUrl = (int)Mage::getStoreConfig('enhancedgrid/images/showurl') === 1;
|
| 38 |
+
if(self::$showByDefault == null)
|
| 39 |
+
self::$showByDefault = (int)Mage::getStoreConfig('enhancedgrid/images/showbydefault') === 1;
|
| 40 |
+
if(self::$width == null)
|
| 41 |
+
self::$width = Mage::getStoreConfig('enhancedgrid/images/width');
|
| 42 |
+
if(self::$height == null)
|
| 43 |
+
self::$height = Mage::getStoreConfig('enhancedgrid/images/height');
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Renders grid column
|
| 48 |
+
*
|
| 49 |
+
* @param Varien_Object $row
|
| 50 |
+
* @return string
|
| 51 |
+
*/
|
| 52 |
+
public function render(Varien_Object $row)
|
| 53 |
+
{
|
| 54 |
+
|
| 55 |
+
return $this->_getValue($row);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/*
|
| 59 |
+
public function renderProperty(Varien_Object $row)
|
| 60 |
+
{
|
| 61 |
+
$val = $row->getData($this->getColumn()->getIndex());
|
| 62 |
+
$val = Mage::helper('imagebyurl')->getImageUrl($val);
|
| 63 |
+
$out = parent::renderProperty(). ' onclick="showImage('.$val.')" ';
|
| 64 |
+
return $out;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
*/
|
| 68 |
+
protected function _getValue(Varien_Object $row)
|
| 69 |
+
{
|
| 70 |
+
|
| 71 |
+
$dored = false;
|
| 72 |
+
if ($getter = $this->getColumn()->getGetter()) {
|
| 73 |
+
$val = $row->$getter();
|
| 74 |
+
}
|
| 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 .= "[!]";
|
| 82 |
+
}
|
| 83 |
+
if(strpos($val, "placeholder/")) {
|
| 84 |
+
$dored = true;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
$filename = substr($val2, strrpos($val2, "/")+1, strlen($val2)-strrpos($val2, "/")-1);
|
| 88 |
+
if(!self::$showImagesUrl) $filename = '';
|
| 89 |
+
if($dored) {
|
| 90 |
+
$val = "<span style=\"color:red\" id=\"img\">$filename</span>";
|
| 91 |
+
} else {
|
| 92 |
+
$val = "<span>". $filename ."</span>";
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
$out = $val. '<center><a href="#" onclick="window.open(\''. $url .'\', \''. $val2 .'\')"'.
|
| 96 |
+
'title="'. $val2 .'" '. ' url="'.$url.'" id="imageurl">';
|
| 97 |
+
|
| 98 |
+
if(self::$showByDefault) {
|
| 99 |
+
$out .= "<img src=". $url ." width='". self::$width ."' ";
|
| 100 |
+
$out .= "height='". self::$height ."' /> ";
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
$out .= '</a></center>';
|
| 104 |
+
|
| 105 |
+
return $out;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
}
|
app/code/community/TBT/Enhancedgrid/Helper/Data.php
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?PHP
|
| 2 |
+
|
| 3 |
+
class TBT_Enhancedgrid_Helper_Data extends Mage_Core_Helper_Abstract {
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
public function getImageUrl($image_file)
|
| 7 |
+
{
|
| 8 |
+
$url = false;
|
| 9 |
+
$url = Mage::getBaseUrl('media').'catalog/product'. $image_file;
|
| 10 |
+
return $url;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
public function getFileExists($image_file)
|
| 15 |
+
{
|
| 16 |
+
$file_exists = false;
|
| 17 |
+
$file_exists = file_exists('media/catalog/product'. $image_file);
|
| 18 |
+
return $file_exists;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
public function getSearchCollection($queryString, $request) {
|
| 23 |
+
$request->setParam('q', $queryString);
|
| 24 |
+
$searchquery = Mage::helper('catalogSearch')->getQuery();
|
| 25 |
+
$searchquery->setStoreId(Mage::app()->getStore()->getId());
|
| 26 |
+
$searchquery->save();
|
| 27 |
+
|
| 28 |
+
return($searchquery->getResultCollection());
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
}
|
| 33 |
+
?>
|
app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Columns/Show.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class TBT_Enhancedgrid_Model_System_Config_Source_Columns_Show
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
|
| 8 |
+
$collection = Mage::getResourceModel('eav/entity_attribute_collection')
|
| 9 |
+
->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )
|
| 10 |
+
->addVisibleFilter();
|
| 11 |
+
$cols = array();
|
| 12 |
+
$cols[] = array('value' => 'id', 'label' => 'ID');
|
| 13 |
+
$cols[] = array('value' => 'type_id', 'label' => 'Type (simple, bundle, etc)');
|
| 14 |
+
$cols[] = array('value' => 'attribute_set_id', 'label' => 'Attribute Set');
|
| 15 |
+
$cols[] = array('value' => 'qty', 'label' => 'Quantity');
|
| 16 |
+
$cols[] = array('value' => 'websites', 'label' => 'Websites');
|
| 17 |
+
foreach($collection->getItems() as $col) {
|
| 18 |
+
$cols[] = array('value' => $col->getAttributeCode(), 'label' => $col->getFrontendLabel());
|
| 19 |
+
}
|
| 20 |
+
return $cols;
|
| 21 |
+
}
|
| 22 |
+
}
|
app/code/community/TBT/Enhancedgrid/Model/System/Config/Source/Sort/Direction.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class TBT_Enhancedgrid_Model_System_Config_Source_Sort_Direction
|
| 4 |
+
{
|
| 5 |
+
public function toOptionArray()
|
| 6 |
+
{
|
| 7 |
+
$sorts = array();
|
| 8 |
+
$sorts[] = array('value' => 'desc', 'label' => 'Descending');
|
| 9 |
+
$sorts[] = array('value' => 'asc', 'label' => 'Ascending');
|
| 10 |
+
return $sorts;
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/community/TBT/Enhancedgrid/controllers/Catalog/ProductController.php
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
* Catalog product controller
|
| 29 |
+
*
|
| 30 |
+
* @category Mage
|
| 31 |
+
* @package Mage_Adminhtml
|
| 32 |
+
* @author Magento Core Team <core@magentocommerce.com>
|
| 33 |
+
*/
|
| 34 |
+
include_once "Mage/Adminhtml/controllers/Catalog/ProductController.php";
|
| 35 |
+
class TBT_Enhancedgrid_Catalog_ProductController extends Mage_Adminhtml_Catalog_ProductController
|
| 36 |
+
{
|
| 37 |
+
protected $massactionEventDispatchEnabled = true;
|
| 38 |
+
protected function _construct()
|
| 39 |
+
{
|
| 40 |
+
// Define module dependent translate
|
| 41 |
+
$this->setUsedModuleName('TBT_Enhancedgrid');
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Product list page
|
| 46 |
+
*/
|
| 47 |
+
public function indexAction()
|
| 48 |
+
{
|
| 49 |
+
$this->loadLayout();
|
| 50 |
+
$this->_setActiveMenu('catalog/enhancedgrid');
|
| 51 |
+
|
| 52 |
+
$this->_addContent(
|
| 53 |
+
$this->getLayout()->createBlock('enhancedgrid/catalog_product')
|
| 54 |
+
);
|
| 55 |
+
|
| 56 |
+
$this->renderLayout();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Product grid for AJAX request
|
| 61 |
+
*/
|
| 62 |
+
public function gridAction()
|
| 63 |
+
{
|
| 64 |
+
$this->loadLayout();
|
| 65 |
+
$this->getResponse()->setBody(
|
| 66 |
+
$this->getLayout()->createBlock('enhancedgrid/catalog_product_grid')->toHtml()
|
| 67 |
+
);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
protected function _isAllowed()
|
| 71 |
+
{
|
| 72 |
+
return Mage::getSingleton('admin/session')->isAllowed('catalog/products');
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* Export product grid to CSV format
|
| 79 |
+
*/
|
| 80 |
+
public function exportCsvAction()
|
| 81 |
+
{
|
| 82 |
+
$fileName = 'products.csv';
|
| 83 |
+
$content = $this->getLayout()->createBlock('massrelater/catalog_product_grid')
|
| 84 |
+
->getCsv();
|
| 85 |
+
|
| 86 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Export product grid to XML format
|
| 91 |
+
*/
|
| 92 |
+
public function exportXmlAction()
|
| 93 |
+
{
|
| 94 |
+
$fileName = 'products.xml';
|
| 95 |
+
$content = $this->getLayout()->createBlock('massrelater/catalog_product_grid')
|
| 96 |
+
->getXml();
|
| 97 |
+
|
| 98 |
+
$this->_sendUploadResponse($fileName, $content);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
| 103 |
+
{
|
| 104 |
+
$response = $this->getResponse();
|
| 105 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
| 106 |
+
|
| 107 |
+
$response->setHeader('Pragma', 'public', true);
|
| 108 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
| 109 |
+
|
| 110 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
| 111 |
+
$response->setHeader('Last-Modified', date('r'));
|
| 112 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
| 113 |
+
$response->setHeader('Content-Length', strlen($content));
|
| 114 |
+
$response->setHeader('Content-type', $contentType);
|
| 115 |
+
$response->setBody($content);
|
| 116 |
+
$response->sendResponse();
|
| 117 |
+
die;
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
| 121 |
+
// Mass Functions BEGIN --> /////////////////////////////////////////////////////
|
| 122 |
+
///////////////////////////////////////////////////////////////////////////////////////////////
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* This will relate all products selected to each other.
|
| 127 |
+
*
|
| 128 |
+
*/
|
| 129 |
+
public function massRefreshProductsAction()
|
| 130 |
+
{
|
| 131 |
+
$productIds = $this->getRequest()->getParam('product');
|
| 132 |
+
if (!is_array($productIds)) {
|
| 133 |
+
$this->_getSession()->addError($this->__('Please select product(s)'));
|
| 134 |
+
}
|
| 135 |
+
else {
|
| 136 |
+
try {
|
| 137 |
+
foreach ($productIds as $productId) {
|
| 138 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
| 139 |
+
if ($this->massactionEventDispatchEnabled)
|
| 140 |
+
Mage::dispatchEvent('catalog_product_prepare_save',
|
| 141 |
+
array('product' => $product, 'request' => $this->getRequest()));
|
| 142 |
+
$product->save();
|
| 143 |
+
}
|
| 144 |
+
$this->_getSession()->addSuccess(
|
| 145 |
+
$this->__('Total of %d record(s) were successfully refreshed.', count($productIds))
|
| 146 |
+
);
|
| 147 |
+
} catch (Exception $e) {
|
| 148 |
+
$this->_getSession()->addError($e->getMessage());
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
$this->_redirect('*/*/index');
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
}
|
app/code/community/TBT/Enhancedgrid/etc/config.xml
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<modules>
|
| 5 |
+
<TBT_Enhancedgrid>
|
| 6 |
+
<version>1.0</version>
|
| 7 |
+
</TBT_Enhancedgrid>
|
| 8 |
+
</modules>
|
| 9 |
+
|
| 10 |
+
<!--
|
| 11 |
+
If you want to overload an admin-controller this tag should be <admin> instead,
|
| 12 |
+
or <adminhtml> if youre overloading such stuff (?)
|
| 13 |
+
-->
|
| 14 |
+
<admin>
|
| 15 |
+
<routers>
|
| 16 |
+
<enhancedgrid>
|
| 17 |
+
<!-- should be set to "admin" when overloading admin stuff (?) -->
|
| 18 |
+
<use>admin</use>
|
| 19 |
+
<args>
|
| 20 |
+
<module>TBT_Enhancedgrid</module>
|
| 21 |
+
<!-- This is used when "catching" the rewrite above -->
|
| 22 |
+
<frontName>enhancedgrid</frontName>
|
| 23 |
+
</args>
|
| 24 |
+
</enhancedgrid>
|
| 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>
|
| 51 |
+
<layout>
|
| 52 |
+
<updates>
|
| 53 |
+
<TBT_Enhancedgrid>
|
| 54 |
+
<file>tbt_enhancedgrid.xml</file>
|
| 55 |
+
</TBT_Enhancedgrid>
|
| 56 |
+
</updates>
|
| 57 |
+
</layout>
|
| 58 |
+
<menu>
|
| 59 |
+
<catalog module="enhancedgrid">
|
| 60 |
+
<children>
|
| 61 |
+
<enhancedgrid module="enhancedgrid">
|
| 62 |
+
<title>Manage Products (Enhanced)</title>
|
| 63 |
+
<sort_order>0</sort_order>
|
| 64 |
+
<action>enhancedgrid/catalog_product</action>
|
| 65 |
+
</enhancedgrid>
|
| 66 |
+
</children>
|
| 67 |
+
</catalog>
|
| 68 |
+
</menu>
|
| 69 |
+
</adminhtml>
|
| 70 |
+
|
| 71 |
+
<default>
|
| 72 |
+
<enhancedgrid>
|
| 73 |
+
<general>
|
| 74 |
+
<isenabled>1</isenabled>
|
| 75 |
+
<truncatelongtextafter>60</truncatelongtextafter>
|
| 76 |
+
</general>
|
| 77 |
+
<columns>
|
| 78 |
+
<showcolumns>id,name,type_id,attribute_set_id,sku,price,qty,visibility,status,websites,image</showcolumns>
|
| 79 |
+
</columns>
|
| 80 |
+
<images>
|
| 81 |
+
<showimagesurl>0</showimagesurl>
|
| 82 |
+
<showbydefault>1</showbydefault>
|
| 83 |
+
<width>75</width>
|
| 84 |
+
<height>75</height>
|
| 85 |
+
</images>
|
| 86 |
+
<griddefaults>
|
| 87 |
+
<limit>20</limit>
|
| 88 |
+
<page>1</page>
|
| 89 |
+
<sort>id</sort>
|
| 90 |
+
<dir>desc</dir>
|
| 91 |
+
</griddefaults>
|
| 92 |
+
</enhancedgrid>
|
| 93 |
+
</default>
|
| 94 |
+
|
| 95 |
+
<adminhtml>
|
| 96 |
+
<acl>
|
| 97 |
+
<resources>
|
| 98 |
+
<all>
|
| 99 |
+
<title>Allow Everything</title>
|
| 100 |
+
</all>
|
| 101 |
+
<admin>
|
| 102 |
+
<children>
|
| 103 |
+
<catalog>
|
| 104 |
+
<children>
|
| 105 |
+
<enhancedgrid>
|
| 106 |
+
<title>Enhanced Product Grid</title>
|
| 107 |
+
</enhancedgrid>
|
| 108 |
+
</children>
|
| 109 |
+
</catalog>
|
| 110 |
+
<system>
|
| 111 |
+
<children>
|
| 112 |
+
<config>
|
| 113 |
+
<children>
|
| 114 |
+
<enhancedgrid>
|
| 115 |
+
<title>Enhanced Grid Config</title>
|
| 116 |
+
</enhancedgrid>
|
| 117 |
+
</children>
|
| 118 |
+
</config>
|
| 119 |
+
</children>
|
| 120 |
+
</system>
|
| 121 |
+
</children>
|
| 122 |
+
</admin>
|
| 123 |
+
</resources>
|
| 124 |
+
</acl>
|
| 125 |
+
</adminhtml>
|
| 126 |
+
</config>
|
app/code/community/TBT/Enhancedgrid/etc/system.xml
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<config>
|
| 3 |
+
|
| 4 |
+
<tabs>
|
| 5 |
+
<tbtall translate="label" module="enhancedgrid">
|
| 6 |
+
<label>TBT Corp 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>
|
| 16 |
+
<show_in_default>1</show_in_default>
|
| 17 |
+
<show_in_website>1</show_in_website>
|
| 18 |
+
<show_in_store>0</show_in_store>
|
| 19 |
+
<groups>
|
| 20 |
+
<columns translate="label">
|
| 21 |
+
<label>General Options</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 |
+
<!--isenabled translate="label">
|
| 27 |
+
<label>Enable Enhanced Grid</label>
|
| 28 |
+
<frontend_type>select</frontend_type>
|
| 29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 30 |
+
<sort_order>10</sort_order>
|
| 31 |
+
<show_in_default>1</show_in_default>
|
| 32 |
+
<show_in_website>1</show_in_website>
|
| 33 |
+
</isenabled-->
|
| 34 |
+
<showcolumns translate="label">
|
| 35 |
+
<label>Show Columns</label>
|
| 36 |
+
<frontend_type>multiselect</frontend_type>
|
| 37 |
+
<source_model>TBT_Enhancedgrid_Model_system_config_source_columns_show</source_model>
|
| 38 |
+
<sort_order>20</sort_order>
|
| 39 |
+
<show_in_default>1</show_in_default>
|
| 40 |
+
<show_in_website>1</show_in_website>
|
| 41 |
+
</showcolumns>
|
| 42 |
+
<truncatelongtextafter translate="label">
|
| 43 |
+
<label>Truncate Long Texts After X Characters </label>
|
| 44 |
+
<frontend_type>text</frontend_type>
|
| 45 |
+
<sort_order>30</sort_order>
|
| 46 |
+
<show_in_default>1</show_in_default>
|
| 47 |
+
<show_in_website>1</show_in_website>
|
| 48 |
+
</truncatelongtextafter>
|
| 49 |
+
<!--showimages translate="label">
|
| 50 |
+
<label>Show Product Images</label>
|
| 51 |
+
<frontend_type>select</frontend_type>
|
| 52 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 53 |
+
<sort_order>30</sort_order>
|
| 54 |
+
<show_in_default>1</show_in_default>
|
| 55 |
+
<show_in_website>1</show_in_website>
|
| 56 |
+
</showimages-->
|
| 57 |
+
</fields>
|
| 58 |
+
</columns>
|
| 59 |
+
<images translate="label">
|
| 60 |
+
<label>In-Grid Image Options</label>
|
| 61 |
+
<sort_order>200</sort_order>
|
| 62 |
+
<show_in_default>1</show_in_default>
|
| 63 |
+
<show_in_website>1</show_in_website>
|
| 64 |
+
<fields>
|
| 65 |
+
<showurl translate="label">
|
| 66 |
+
<label>Show Image Url</label>
|
| 67 |
+
<comment>(When product image is hidden for that row)</comment>
|
| 68 |
+
<frontend_type>select</frontend_type>
|
| 69 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 70 |
+
<sort_order>10</sort_order>
|
| 71 |
+
<show_in_default>1</show_in_default>
|
| 72 |
+
<show_in_website>1</show_in_website>
|
| 73 |
+
</showurl>
|
| 74 |
+
<showbydefault translate="label">
|
| 75 |
+
<label>Show Image By Default</label>
|
| 76 |
+
<comment>If your grid has a large page size by default this could get slow.</comment>
|
| 77 |
+
<frontend_type>select</frontend_type>
|
| 78 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 79 |
+
<sort_order>20</sort_order>
|
| 80 |
+
<show_in_default>1</show_in_default>
|
| 81 |
+
<show_in_website>1</show_in_website>
|
| 82 |
+
</showbydefault>
|
| 83 |
+
<width translate="label">
|
| 84 |
+
<label>Image Width</label>
|
| 85 |
+
<frontend_type>text</frontend_type>
|
| 86 |
+
<sort_order>30</sort_order>
|
| 87 |
+
<show_in_default>1</show_in_default>
|
| 88 |
+
<show_in_website>1</show_in_website>
|
| 89 |
+
</width>
|
| 90 |
+
<height translate="label">
|
| 91 |
+
<label>Image Height</label>
|
| 92 |
+
<frontend_type>text</frontend_type>
|
| 93 |
+
<sort_order>40</sort_order>
|
| 94 |
+
<show_in_default>1</show_in_default>
|
| 95 |
+
<show_in_website>1</show_in_website>
|
| 96 |
+
</height>
|
| 97 |
+
</fields>
|
| 98 |
+
</images>
|
| 99 |
+
<defaults translate="label">
|
| 100 |
+
<label>Default Grid State</label>
|
| 101 |
+
<sort_order>300</sort_order>
|
| 102 |
+
<show_in_default>1</show_in_default>
|
| 103 |
+
<show_in_website>1</show_in_website>
|
| 104 |
+
<fields>
|
| 105 |
+
<limit translate="label">
|
| 106 |
+
<label>Page Size</label>
|
| 107 |
+
<frontend_type>text</frontend_type>
|
| 108 |
+
<sort_order>10</sort_order>
|
| 109 |
+
<show_in_default>1</show_in_default>
|
| 110 |
+
<show_in_website>1</show_in_website>
|
| 111 |
+
</limit>
|
| 112 |
+
<page translate="label">
|
| 113 |
+
<label>Initial Page Number</label>
|
| 114 |
+
<frontend_type>text</frontend_type>
|
| 115 |
+
<sort_order>10</sort_order>
|
| 116 |
+
<show_in_default>1</show_in_default>
|
| 117 |
+
<show_in_website>1</show_in_website>
|
| 118 |
+
</page>
|
| 119 |
+
<sort translate="label">
|
| 120 |
+
<label>Sort Column</label>
|
| 121 |
+
<comment>The selected column must be also selected above if it's not already there</comment>
|
| 122 |
+
<frontend_type>select</frontend_type>
|
| 123 |
+
<source_model>TBT_Enhancedgrid_Model_system_config_source_columns_show</source_model>
|
| 124 |
+
<sort_order>10</sort_order>
|
| 125 |
+
<show_in_default>1</show_in_default>
|
| 126 |
+
<show_in_website>1</show_in_website>
|
| 127 |
+
</sort>
|
| 128 |
+
<dir translate="label">
|
| 129 |
+
<label>Sort Column Direction</label>
|
| 130 |
+
<frontend_type>select</frontend_type>
|
| 131 |
+
<source_model>TBT_Enhancedgrid_Model_system_config_source_sort_direction</source_model>
|
| 132 |
+
<sort_order>10</sort_order>
|
| 133 |
+
<show_in_default>1</show_in_default>
|
| 134 |
+
<show_in_website>1</show_in_website>
|
| 135 |
+
</dir>
|
| 136 |
+
</fields>
|
| 137 |
+
</defaults>
|
| 138 |
+
<!--export translate="label">
|
| 139 |
+
<label>Products Grid Export</label>
|
| 140 |
+
<sort_order>200</sort_order>
|
| 141 |
+
<show_in_default>1</show_in_default>
|
| 142 |
+
<show_in_website>1</show_in_website>
|
| 143 |
+
<fields>
|
| 144 |
+
<isenabled translate="label">
|
| 145 |
+
<label>Enable Quick Export</label>
|
| 146 |
+
<frontend_type>select</frontend_type>
|
| 147 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 148 |
+
<sort_order>10</sort_order>
|
| 149 |
+
<show_in_default>1</show_in_default>
|
| 150 |
+
<show_in_website>1</show_in_website>
|
| 151 |
+
</isenabled>
|
| 152 |
+
</fields>
|
| 153 |
+
</export-->
|
| 154 |
+
<!--search translate="label">
|
| 155 |
+
<label>Products Grid Search</label>
|
| 156 |
+
<sort_order>300</sort_order>
|
| 157 |
+
<show_in_default>1</show_in_default>
|
| 158 |
+
<show_in_website>1</show_in_website>
|
| 159 |
+
<fields>
|
| 160 |
+
<isenabled translate="label">
|
| 161 |
+
<label>Enable Fulltext Search</label>
|
| 162 |
+
<frontend_type>select</frontend_type>
|
| 163 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
| 164 |
+
<sort_order>50</sort_order>
|
| 165 |
+
<show_in_default>1</show_in_default>
|
| 166 |
+
<show_in_website>1</show_in_website>
|
| 167 |
+
</isenabled>
|
| 168 |
+
</fields>
|
| 169 |
+
</search-->
|
| 170 |
+
</groups>
|
| 171 |
+
</enhancedgrid>
|
| 172 |
+
</sections>
|
| 173 |
+
</config>
|
app/design/adminhtml/default/default/layout/tbt_enhancedgrid.xml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* Trade Business Technology Corp.
|
| 5 |
+
*
|
| 6 |
+
* NOTICE OF LICENSE
|
| 7 |
+
*
|
| 8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 10 |
+
* It is also available through the world-wide-web at this URL:
|
| 11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 12 |
+
* If you did not receive a copy of the license and are unable to
|
| 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 |
+
* DISCLAIMER
|
| 17 |
+
*
|
| 18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 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/adminhtml/enhancedgrid/enhancedgrid.js</script></action>
|
| 34 |
+
<action method="addJs"><script>tbt/adminhtml/enhancedgrid/egsupplemental.js</script></action>
|
| 35 |
+
<action method="addJs"><script>tbt/adminhtml/enhancedgrid/customfunctions/catalog_products.js</script></action>
|
| 36 |
+
<action method="addItem"><type>js_css</type><name>tbt/adminhtml/enhancedgrid/resources/css/enhancedgrid.css</name></action>
|
| 37 |
+
</reference>
|
| 38 |
+
</default>
|
| 39 |
+
</layout>
|
app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product.phtml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-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 design_default
|
| 22 |
+
* @package Mage
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<div class="content-header">
|
| 28 |
+
<table cellspacing="0">
|
| 29 |
+
<tr>
|
| 30 |
+
<td style="width:50%;"><h3 class="icon-head head-products"><?php echo $this->_headerText ?></h3></td>
|
| 31 |
+
<td class="a-right">
|
| 32 |
+
<?php echo $this->getAddNewButtonHtml() ?>
|
| 33 |
+
</td>
|
| 34 |
+
</tr>
|
| 35 |
+
</table>
|
| 36 |
+
</div>
|
| 37 |
+
<?php echo $this->getStoreSwitcherHtml() ?>
|
| 38 |
+
<div>
|
| 39 |
+
<?php echo $this->getGridHtml() ?>
|
| 40 |
+
</div>
|
app/design/adminhtml/default/default/template/tbt/enhancedgrid/catalog/product/grid.phtml
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Magento
|
| 4 |
+
*
|
| 5 |
+
* NOTICE OF LICENSE
|
| 6 |
+
*
|
| 7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 9 |
+
* It is also available through the world-wide-web at this URL:
|
| 10 |
+
* http://opensource.org/licenses/afl-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 design_default
|
| 22 |
+
* @package Mage
|
| 23 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<?php
|
| 28 |
+
/**
|
| 29 |
+
* Template for Mage_Adminhtml_Block_Widget_Grid
|
| 30 |
+
*
|
| 31 |
+
* getId()
|
| 32 |
+
* getCollection()
|
| 33 |
+
* getColumns()
|
| 34 |
+
* getPagerVisibility()
|
| 35 |
+
* getVarNamePage()
|
| 36 |
+
*/
|
| 37 |
+
$numColumns = sizeof($this->getColumns());
|
| 38 |
+
?>
|
| 39 |
+
<?php if($this->getCollection()): ?>
|
| 40 |
+
<?php if($this->canDisplayContainer()): ?>
|
| 41 |
+
<?php if($this->getGridHeader()): ?>
|
| 42 |
+
<div class="content-header">
|
| 43 |
+
<table cellspacing="0">
|
| 44 |
+
<tr>
|
| 45 |
+
<td style="width:50%;"><h2><?php echo $this->getGridHeader(); ?></h2></td>
|
| 46 |
+
</tr>
|
| 47 |
+
</table>
|
| 48 |
+
</div>
|
| 49 |
+
<?php endif ?>
|
| 50 |
+
|
| 51 |
+
<div id="<?php echo $this->getId() ?>">
|
| 52 |
+
<?php else: ?>
|
| 53 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
| 54 |
+
<?php endif; ?>
|
| 55 |
+
<?php if($this->getPagerVisibility() || $this->getExportTypes() || $this->getFilterVisibility()): ?>
|
| 56 |
+
<table cellspacing="0" class="actions">
|
| 57 |
+
<tr>
|
| 58 |
+
<?php if($this->getPagerVisibility()): ?>
|
| 59 |
+
<td class="pager">
|
| 60 |
+
<?php echo $this->__('Page') ?>
|
| 61 |
+
|
| 62 |
+
<?php $_curPage = $this->getCollection()->getCurPage() ?>
|
| 63 |
+
<?php $_lastPage = $this->getCollection()->getLastPageNumber() ?>
|
| 64 |
+
<?php if($_curPage>1): ?>
|
| 65 |
+
<a href="#" title="<?php echo $this->__('Previous page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage-1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="Go to Previous page" class="arrow"/></a>
|
| 66 |
+
<?php else: ?>
|
| 67 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_left_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
| 68 |
+
<?php endif; ?>
|
| 69 |
+
|
| 70 |
+
<input type="text" name="<?php echo $this->getVarNamePage() ?>" value="<?php echo $_curPage ?>" class="input-text page" onkeypress="<?php echo $this->getId() ?>JsObject.inputPage(event, '<?php echo $_lastPage ?>')"/>
|
| 71 |
+
|
| 72 |
+
<?php if($_curPage < $_lastPage): ?>
|
| 73 |
+
<a href="#" title="<?php echo $this->__('Next page') ?>" onclick="<?php echo $this->getId() ?>JsObject.setPage('<?php echo ($_curPage+1) ?>');return false;"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="Go to Next page" class="arrow"/></a>
|
| 74 |
+
<?php else: ?>
|
| 75 |
+
<img src="<?php echo $this->getSkinUrl('images/pager_arrow_right_off.gif') ?>" alt="Go to Previous page" class="arrow"/>
|
| 76 |
+
<?php endif; ?>
|
| 77 |
+
|
| 78 |
+
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
|
| 79 |
+
<span class="separator">|</span>
|
| 80 |
+
<?php echo $this->__('View') ?>
|
| 81 |
+
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getId() ?>JsObject.loadByElement(this)">
|
| 82 |
+
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
|
| 83 |
+
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
|
| 84 |
+
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
|
| 85 |
+
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
|
| 86 |
+
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
|
| 87 |
+
</select>
|
| 88 |
+
<?php echo $this->__('per page') ?><span class="separator">|</span>
|
| 89 |
+
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
|
| 90 |
+
<span id="<?php echo $this->getHtmlId() ?>-total-count" class="no-display"><?php echo $this->getCollection()->getSize() ?></span>
|
| 91 |
+
<?php if($this->getRssLists()): ?>
|
| 92 |
+
<?php foreach ($this->getRssLists() as $_rss): ?>
|
| 93 |
+
<span class="separator">|</span><a href="<?php echo $_rss->getUrl() ?>" class="link-feed"><?php echo $_rss->getLabel() ?></a>
|
| 94 |
+
<?php endforeach ?>
|
| 95 |
+
<?php endif; ?>
|
| 96 |
+
</td>
|
| 97 |
+
<?php endif ?>
|
| 98 |
+
<?php if($this->getExportTypes()): ?>
|
| 99 |
+
<td class="export a-right">
|
| 100 |
+
<img src="<?php echo $this->getSkinUrl('images/icon_export.gif') ?>" alt="" class="v-middle"/> <?php echo $this->__('Export to:') ?>
|
| 101 |
+
<select name="<?php echo $this->getId() ?>_export" id="<?php echo $this->getId() ?>_export" style="width:8em;">
|
| 102 |
+
<?php foreach ($this->getExportTypes() as $_type): ?>
|
| 103 |
+
<option value="<?php echo $_type->getUrl() ?>"><?php echo $_type->getLabel() ?></option>
|
| 104 |
+
<?php endforeach; ?>
|
| 105 |
+
</select>
|
| 106 |
+
<?php echo $this->getExportButtonHtml() ?>
|
| 107 |
+
</td>
|
| 108 |
+
<?php endif; ?>
|
| 109 |
+
<td class="filter-actions a-right">
|
| 110 |
+
<input type="text" value="<?php echo $this->getQueryStr(); ?>" id="enhancedGridSearchQry" onkeypress="if(keyWasPressed(event, 13)) { productGridJsObject.doFilter(); }">
|
| 111 |
+
<?php echo $this->getMainButtonsHtml() ?>
|
| 112 |
+
</td>
|
| 113 |
+
</tr>
|
| 114 |
+
</table>
|
| 115 |
+
<?php endif; ?>
|
| 116 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
| 117 |
+
<?php echo $this->getMassactionBlockHtml() ?>
|
| 118 |
+
<?php endif ?>
|
| 119 |
+
<div class="grid">
|
| 120 |
+
<div class="hor-scroll">
|
| 121 |
+
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
|
| 122 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
| 123 |
+
<col <?php echo $_column->getHtmlProperty() ?> />
|
| 124 |
+
<?php endforeach; ?>
|
| 125 |
+
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
|
| 126 |
+
<thead>
|
| 127 |
+
<?php if ($this->getHeadersVisibility()): ?>
|
| 128 |
+
<tr class="headings">
|
| 129 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
| 130 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
|
| 131 |
+
<?php endforeach; ?>
|
| 132 |
+
</tr>
|
| 133 |
+
<?php endif; ?>
|
| 134 |
+
<?php if ($this->getFilterVisibility()): ?>
|
| 135 |
+
<tr class="filter">
|
| 136 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
| 137 |
+
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
|
| 138 |
+
<?php endforeach; ?>
|
| 139 |
+
</tr>
|
| 140 |
+
<?php endif ?>
|
| 141 |
+
</thead>
|
| 142 |
+
<?php endif; ?>
|
| 143 |
+
<?php if ($this->getCountTotals()): ?>
|
| 144 |
+
<tfoot>
|
| 145 |
+
<tr>
|
| 146 |
+
<?php foreach ($this->getColumns() as $_column): ?>
|
| 147 |
+
<th class="<?php echo $_column->getCssProperty() ?>"><?php echo $_column->getRowField($_column->getGrid()->getTotals()) ?> </th>
|
| 148 |
+
<?php endforeach; ?>
|
| 149 |
+
</tr>
|
| 150 |
+
</tfoot>
|
| 151 |
+
<?php endif; ?>
|
| 152 |
+
<tbody>
|
| 153 |
+
<?php if (($this->getCollection()->getSize()>0) && (!$this->getIsCollapsed())): ?>
|
| 154 |
+
<?php foreach ($this->getCollection() as $_index=>$_item): ?>
|
| 155 |
+
<tr title="<?php echo $this->getRowUrl($_item) ?>"<?php if ($_class = $this->getRowClass($_item)):?> class="<?php echo $_class; ?>"<?php endif;?> >
|
| 156 |
+
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
|
| 157 |
+
<td class="<?php echo $_column->getCssProperty() ?> <?php echo ++$i==$numColumns?'last':'' ?>"><?php echo (($_html = $_column->getRowField($_item)) != '' ? $_html : ' ') ?></td>
|
| 158 |
+
<?php endforeach; ?>
|
| 159 |
+
</tr>
|
| 160 |
+
<?php endforeach; ?>
|
| 161 |
+
<?php elseif ($this->getEmptyText()): ?>
|
| 162 |
+
<tr>
|
| 163 |
+
<td class="empty-text <?php echo $this->getEmptyTextClass() ?>" colspan="100"><?php echo $this->getEmptyText() ?></td>
|
| 164 |
+
</tr>
|
| 165 |
+
<?php endif; ?>
|
| 166 |
+
</tbody>
|
| 167 |
+
</table>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
<?php if($this->canDisplayContainer()): ?>
|
| 171 |
+
</div>
|
| 172 |
+
<script type="text/javascript">
|
| 173 |
+
//<![CDATA[
|
| 174 |
+
<?php echo $this->getJsObjectName() ?> = new varienGrid('<?php echo $this->getId() ?>', '<?php echo $this->getGridUrl() ?>', '<?php echo $this->getVarNamePage() ?>', '<?php echo $this->getVarNameSort() ?>', '<?php echo $this->getVarNameDir() ?>', '<?php echo $this->getVarNameFilter() ?>');
|
| 175 |
+
<?php echo $this->getJsObjectName() ?>.useAjax = '<?php echo $this->getUseAjax() ?>';
|
| 176 |
+
<?php if($this->getRowClickCallback()): ?>
|
| 177 |
+
<?php echo $this->getJsObjectName() ?>.rowClickCallback = <?php echo $this->getRowClickCallback() ?>;
|
| 178 |
+
<?php endif; ?>
|
| 179 |
+
<?php if($this->getCheckboxCheckCallback()): ?>
|
| 180 |
+
<?php echo $this->getJsObjectName() ?>.checkboxCheckCallback = <?php echo $this->getCheckboxCheckCallback() ?>;
|
| 181 |
+
<?php endif; ?>
|
| 182 |
+
<?php if($this->getRowInitCallback()): ?>
|
| 183 |
+
<?php echo $this->getJsObjectName() ?>.initRowCallback = <?php echo $this->getRowInitCallback() ?>;
|
| 184 |
+
<?php echo $this->getJsObjectName() ?>.rows.each(function(row){<?php echo $this->getRowInitCallback() ?>(<?php echo $this->getJsObjectName() ?>, row)});
|
| 185 |
+
<?php endif; ?>
|
| 186 |
+
<?php if($this->getMassactionBlock()->isAvailable()): ?>
|
| 187 |
+
<?php echo $this->getMassactionBlock()->getJavaScript() ?>
|
| 188 |
+
<?php endif ?>
|
| 189 |
+
//]]>
|
| 190 |
+
</script>
|
| 191 |
+
<?php endif; ?>
|
| 192 |
+
<?php endif ?>
|
app/etc/modules/TBT_Enhancedgrid.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<TBT_Enhancedgrid>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</TBT_Enhancedgrid>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
js/tbt/enhancedgrid/customfunctions/catalog_products.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
function chooseWhatToRelateTo() {
|
| 3 |
+
var productids = window.prompt("Enter the id's for products you'd like to relate the currently selected products to.\n"
|
| 4 |
+
+"For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, X will be\n"
|
| 5 |
+
+"related to A and B, Y will be related to A and B, etc.\n"
|
| 6 |
+
+"Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
| 7 |
+
if (productids == "" || productids == null) {
|
| 8 |
+
return null
|
| 9 |
+
}
|
| 10 |
+
if (!window.confirm("Are you sure you'd like to one-way relate selected grid products to products ("+ productids +")")) {
|
| 11 |
+
return null
|
| 12 |
+
}
|
| 13 |
+
return productids;
|
| 14 |
+
}
|
| 15 |
+
function chooseWhatToCrossSellTo() {
|
| 16 |
+
var productids = window.prompt("Enter the id's for products you'd like to add as cross-sell to the currently selected products.\n"
|
| 17 |
+
+"For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, X will be\n"
|
| 18 |
+
+"cross-sold to A and B, Y will be cross-sold with A and with B, etc.\n"
|
| 19 |
+
+"Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
| 20 |
+
if (productids == "" || productids == null) {
|
| 21 |
+
return null
|
| 22 |
+
}
|
| 23 |
+
if (!window.confirm("Are you sure you'd like to one-way cross-sell products ("+ productids +") to selected grid products?")) {
|
| 24 |
+
return null
|
| 25 |
+
}
|
| 26 |
+
return productids;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
function chooseWhatToUpSellTo() {
|
| 30 |
+
var productids = window.prompt("Enter the id's for products you'd like to add as up-sells to the currently selected products.\n"
|
| 31 |
+
+"For example: Suppose you selected X, Y and Z. If you enter 'A,B' here, A and B will be\n"
|
| 32 |
+
+"up-sells of X , A and B will be up-sells of Y, etc.\n"
|
| 33 |
+
+"Separate multiple product ids by a comma as shown in the example above.", "<Enter product IDs (NOT SKUs!)>");
|
| 34 |
+
if (productids == "" || productids == null) {
|
| 35 |
+
return null
|
| 36 |
+
}
|
| 37 |
+
if (!window.confirm("Are you sure you'd like add products ("+ productids +") to selected grid products up-sell?")) {
|
| 38 |
+
return null
|
| 39 |
+
}
|
| 40 |
+
return productids;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
function showSelectedImages(gridObj, checkedValues, imgTemplate) {
|
| 46 |
+
var matchCounter = 0;
|
| 47 |
+
gridObj.walkSelectedRows(function(ie){
|
| 48 |
+
ie.getElementsBySelector('a').each(function(a) {
|
| 49 |
+
if(a.id == "imageurl") {
|
| 50 |
+
matchCounter++;
|
| 51 |
+
a.innerHTML = imgTemplate.replace("{imgurl}", a.getAttribute('url'));
|
| 52 |
+
}
|
| 53 |
+
});
|
| 54 |
+
});
|
| 55 |
+
if(matchCounter == 0) {
|
| 56 |
+
alert("Either there was no image column, or the image column could not be found");
|
| 57 |
+
}
|
| 58 |
+
return null;
|
| 59 |
+
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
function hideSelectedImages(gridObj, checkedValues) {
|
| 63 |
+
var matchCounter = 0;
|
| 64 |
+
gridObj.walkSelectedRows(function(ie){
|
| 65 |
+
ie.getElementsBySelector('a').each(function(a) {
|
| 66 |
+
if(a.id == "imageurl") {
|
| 67 |
+
matchCounter++;
|
| 68 |
+
a.innerHTML = "@";
|
| 69 |
+
}
|
| 70 |
+
});
|
| 71 |
+
});
|
| 72 |
+
if(matchCounter == 0) {
|
| 73 |
+
alert("Either there was no image column, or the image column could not be found");
|
| 74 |
+
}
|
| 75 |
+
return null;
|
| 76 |
+
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
function openAllImages(gridObj, checkedValues) {
|
| 80 |
+
gridObj.walkSelectedRows(function(ie){
|
| 81 |
+
ie.getElementsBySelector('a').each(function(a) {
|
| 82 |
+
if(a.id == "imageurl") {
|
| 83 |
+
window.open(a.getAttribute('url'));
|
| 84 |
+
}
|
| 85 |
+
});
|
| 86 |
+
}, 30);
|
| 87 |
+
return null;
|
| 88 |
+
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
function openAll(gridObj, checkedValues) {
|
| 92 |
+
gridObj.walkSelectedRows(function(ie){
|
| 93 |
+
window.open(ie.id);
|
| 94 |
+
}, 20);
|
| 95 |
+
return null;
|
| 96 |
+
|
| 97 |
+
}
|
js/tbt/enhancedgrid/egsupplemental.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
//form tags to omit in NS6+:
|
| 3 |
+
|
| 4 |
+
var omitformtags=["input", "textarea", "select"]
|
| 5 |
+
|
| 6 |
+
omitformtags=omitformtags.join("|")
|
| 7 |
+
|
| 8 |
+
function disableselect(e){
|
| 9 |
+
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
|
| 10 |
+
return false
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
function reEnable(){
|
| 14 |
+
return true
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
var originalHighlighting = false;
|
| 18 |
+
|
| 19 |
+
function disableHighlighting() {
|
| 20 |
+
if (typeof document.onselectstart!="undefined") {
|
| 21 |
+
originalHighlighting = document.onselectstart;
|
| 22 |
+
document.onselectstart=new Function ("return false")
|
| 23 |
+
} else{
|
| 24 |
+
originalHighlighting = {
|
| 25 |
+
down: document.onmousedown,
|
| 26 |
+
up: document.onmouseup
|
| 27 |
+
}
|
| 28 |
+
document.onmousedown=disableselect
|
| 29 |
+
document.onmouseup=reEnable
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
function enableHighlighting() {
|
| 34 |
+
if (typeof document.onselectstart!="undefined") {
|
| 35 |
+
document.onselectstart = originalHighlighting;
|
| 36 |
+
} else{
|
| 37 |
+
document.onmousedown=originalHighlighting.down;
|
| 38 |
+
document.onmouseup=originalHighlighting.up;
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
function keyWasPressed(e, targetKeyNum) {
|
| 43 |
+
var keychar;
|
| 44 |
+
var numcheck;
|
| 45 |
+
|
| 46 |
+
if(window.event) // IE
|
| 47 |
+
{
|
| 48 |
+
keynum = e.keyCode;
|
| 49 |
+
}
|
| 50 |
+
else if(e.which) // Netscape/Firefox/Opera
|
| 51 |
+
{
|
| 52 |
+
keynum = e.which;
|
| 53 |
+
}
|
| 54 |
+
if(keynum == targetKeyNum) return true;
|
| 55 |
+
return false;
|
| 56 |
+
}
|
js/tbt/enhancedgrid/enhancedgrid.js
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Magento
|
| 3 |
+
*
|
| 4 |
+
* NOTICE OF LICENSE
|
| 5 |
+
*
|
| 6 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
| 7 |
+
* that is bundled with this package in the file LICENSE.txt.
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/osl-3.0.php
|
| 10 |
+
* If you did not receive a copy of the license and are unable to
|
| 11 |
+
* obtain it through the world-wide-web, please send an email
|
| 12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 13 |
+
*
|
| 14 |
+
* @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
|
| 15 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
varienGrid.prototype.initialize = function(containerId, url, pageVar, sortVar, dirVar, filterVar){
|
| 20 |
+
this.containerId = containerId;
|
| 21 |
+
this.url = url;
|
| 22 |
+
this.pageVar = pageVar || false;
|
| 23 |
+
this.sortVar = sortVar || false;
|
| 24 |
+
this.dirVar = dirVar || false;
|
| 25 |
+
this.filterVar = filterVar || false;
|
| 26 |
+
this.tableSufix = '_table';
|
| 27 |
+
this.useAjax = false;
|
| 28 |
+
this.rowClickCallback = false;
|
| 29 |
+
this.checkboxCheckCallback = false;
|
| 30 |
+
this.preInitCallback = false;
|
| 31 |
+
this.initCallback = false;
|
| 32 |
+
this.initRowCallback = false;
|
| 33 |
+
this.doFilterCallback = false;
|
| 34 |
+
|
| 35 |
+
// muliselect row
|
| 36 |
+
this.selectedRowEvents = {};
|
| 37 |
+
this.doMultiSelect = false;
|
| 38 |
+
this.multiSelectFunction = function(events) { this.onMultiSelect(events); };
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
this.reloadParams = false;
|
| 42 |
+
|
| 43 |
+
this.trOnMouseOver = this.rowMouseOver.bindAsEventListener(this);
|
| 44 |
+
this.trOnMouseOut = this.rowMouseOut.bindAsEventListener(this);
|
| 45 |
+
this.trOnMouseUp = this.rowMouseUp.bindAsEventListener(this);
|
| 46 |
+
this.trOnMouseDown = this.rowMouseDown.bindAsEventListener(this);
|
| 47 |
+
this.trOnMouseMove = this.rowMouseMove.bindAsEventListener(this);
|
| 48 |
+
this.trOnClick = this.rowMouseClick.bindAsEventListener(this);
|
| 49 |
+
this.trOnDblClick = this.rowMouseDblClick.bindAsEventListener(this);
|
| 50 |
+
this.trOnKeyPress = this.keyPress.bindAsEventListener(this);
|
| 51 |
+
|
| 52 |
+
this.thLinkOnClick = this.doSort.bindAsEventListener(this);
|
| 53 |
+
this.initGrid();
|
| 54 |
+
};
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
varienGrid.prototype.initGrid = function(){
|
| 58 |
+
if(this.preInitCallback){
|
| 59 |
+
this.preInitCallback(this);
|
| 60 |
+
}
|
| 61 |
+
if($(this.containerId+this.tableSufix)){
|
| 62 |
+
this.rows = $$('#'+this.containerId+this.tableSufix+' tbody tr');
|
| 63 |
+
for (var row=0; row<this.rows.length; row++) {
|
| 64 |
+
if(row%2==0){
|
| 65 |
+
Element.addClassName(this.rows[row], 'even');
|
| 66 |
+
}
|
| 67 |
+
Event.observe(this.rows[row],'mouseover',this.trOnMouseOver);
|
| 68 |
+
Event.observe(this.rows[row],'mouseout',this.trOnMouseOut);
|
| 69 |
+
Event.observe(this.rows[row],'click',this.trOnClick);
|
| 70 |
+
Event.observe(this.rows[row],'dblclick',this.trOnDblClick);
|
| 71 |
+
Event.observe(this.rows[row],'mouseup',this.trOnMouseUp);
|
| 72 |
+
Event.observe(this.rows[row],'mousedown',this.trOnMouseDown);
|
| 73 |
+
Event.observe(this.rows[row],'mousemove',this.trOnMouseMove);
|
| 74 |
+
|
| 75 |
+
if(this.initRowCallback){
|
| 76 |
+
try {
|
| 77 |
+
this.initRowCallback(this, this.rows[row]);
|
| 78 |
+
} catch (e) {
|
| 79 |
+
if(console) {
|
| 80 |
+
console.log(e);
|
| 81 |
+
}
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
}
|
| 85 |
+
}
|
| 86 |
+
if(this.sortVar && this.dirVar){
|
| 87 |
+
var columns = $$('#'+this.containerId+this.tableSufix+' thead a');
|
| 88 |
+
|
| 89 |
+
for(var col=0; col<columns.length; col++){
|
| 90 |
+
Event.observe(columns[col],'click',this.thLinkOnClick);
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
this.bindFilterFields();
|
| 94 |
+
this.bindFieldsChange();
|
| 95 |
+
if(this.initCallback){
|
| 96 |
+
try {
|
| 97 |
+
this.initCallback(this);
|
| 98 |
+
}
|
| 99 |
+
catch (e) {
|
| 100 |
+
if(console) {
|
| 101 |
+
console.log(e);
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
}
|
| 105 |
+
};
|
| 106 |
+
varienGrid.prototype.rowMouseOver = function(event){
|
| 107 |
+
var element = Event.findElement(event, 'tr');
|
| 108 |
+
Element.addClassName(element, 'on-mouse');
|
| 109 |
+
|
| 110 |
+
if (!Element.hasClassName('pointer')
|
| 111 |
+
&& (this.rowClickCallback !== openGridRow || element.id)) {
|
| 112 |
+
Element.addClassName(element, 'pointer');
|
| 113 |
+
}
|
| 114 |
+
if(this.doMultiSelect) {
|
| 115 |
+
if (this.addMultiSelectedRow(event, element)) {
|
| 116 |
+
// row is already selected...
|
| 117 |
+
} else {
|
| 118 |
+
Element.addClassName(element, 'multiselect')
|
| 119 |
+
}
|
| 120 |
+
}
|
| 121 |
+
};
|
| 122 |
+
varienGrid.prototype.rowMouseMove = function(event){
|
| 123 |
+
};
|
| 124 |
+
varienGrid.prototype.addMultiSelectedRow = function(event, rowElement) {
|
| 125 |
+
var checkbox = this.findCheckbox(event);
|
| 126 |
+
var newId = checkbox.value;
|
| 127 |
+
if(this.selectedRowEvents[newId] != null) {
|
| 128 |
+
return false;
|
| 129 |
+
}
|
| 130 |
+
this.selectedRowEvents[newId] = {
|
| 131 |
+
event: event,
|
| 132 |
+
rowElement: rowElement,
|
| 133 |
+
checkbox: checkbox
|
| 134 |
+
};
|
| 135 |
+
};
|
| 136 |
+
varienGrid.prototype.findCheckbox = function(evt) {
|
| 137 |
+
if(['a', 'input', 'select'].indexOf(Event.element(evt).tagName.toLowerCase())!==-1) {
|
| 138 |
+
return false;
|
| 139 |
+
}
|
| 140 |
+
checkbox = false;
|
| 141 |
+
Event.findElement(evt, 'tr').getElementsBySelector('input[type=checkbox]').each(function(element){
|
| 142 |
+
checkbox = element;
|
| 143 |
+
}.bind(this));
|
| 144 |
+
return checkbox;
|
| 145 |
+
};
|
| 146 |
+
varienGrid.prototype.removeMultiSelectedRow = function(event, rowElement) {
|
| 147 |
+
if(this.selectedRowEvents[rowElement.id] != null) {
|
| 148 |
+
this.selectedRowEvents[rowElement.id] = null;
|
| 149 |
+
}
|
| 150 |
+
return false;
|
| 151 |
+
}
|
| 152 |
+
varienGrid.prototype.rowMouseUp = function(event){
|
| 153 |
+
if(this.doMultiSelect) {
|
| 154 |
+
enableHighlighting();
|
| 155 |
+
this.doMultiSelect = false;
|
| 156 |
+
this.multiSelectFunction(this.selectedRowEvents);
|
| 157 |
+
}
|
| 158 |
+
};
|
| 159 |
+
varienGrid.prototype.rowMouseDown = function(event){
|
| 160 |
+
if(event.ctrlKey) {
|
| 161 |
+
if(['a', 'input', 'select'].indexOf(Event.element(event).tagName.toLowerCase())!==-1) {
|
| 162 |
+
return false;
|
| 163 |
+
}
|
| 164 |
+
disableHighlighting();
|
| 165 |
+
this.doMultiSelect = true;
|
| 166 |
+
this.selectedRowEvents = {};
|
| 167 |
+
// Add the row we just clicked on
|
| 168 |
+
var element = Event.findElement(event, 'tr');
|
| 169 |
+
this.addMultiSelectedRow(event, element);
|
| 170 |
+
Element.addClassName(element, 'multiselect')
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
varienGrid.prototype.rowMouseClick = function(event){
|
| 174 |
+
if(this.doMultiSelect) {
|
| 175 |
+
this.doMultiSelect = false;
|
| 176 |
+
return;
|
| 177 |
+
}
|
| 178 |
+
if(event.ctrlKey) return;
|
| 179 |
+
|
| 180 |
+
if(this.rowClickCallback){
|
| 181 |
+
try{
|
| 182 |
+
this.rowClickCallback(this, event);
|
| 183 |
+
}
|
| 184 |
+
catch(e){}
|
| 185 |
+
}
|
| 186 |
+
varienGlobalEvents.fireEvent('gridRowClick', event);
|
| 187 |
+
};
|
| 188 |
+
// Multiselect
|
| 189 |
+
varienGrid.prototype.onMultiSelect = function(events) {
|
| 190 |
+
for(rowid in events) {
|
| 191 |
+
var multiRowEvent = events[rowid];
|
| 192 |
+
var checkbox = multiRowEvent.checkbox;
|
| 193 |
+
this.setCheckboxChecked(checkbox, checkbox.checked ? false : true);
|
| 194 |
+
multiRowEvent.rowElement.blur();
|
| 195 |
+
Element.removeClassName(multiRowEvent.rowElement, 'multiselect');
|
| 196 |
+
}
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
varienGridMassaction.prototype.initialize = function (containerId, grid, checkedValues, formFieldNameInternal, formFieldName) {
|
| 201 |
+
// MAGE -- begin
|
| 202 |
+
this.setOldCallback('row_click', grid.rowClickCallback);
|
| 203 |
+
this.setOldCallback('init', grid.initCallback);
|
| 204 |
+
this.setOldCallback('init_row', grid.initRowCallback);
|
| 205 |
+
this.setOldCallback('pre_init', grid.preInitCallback);
|
| 206 |
+
|
| 207 |
+
this.useAjax = false;
|
| 208 |
+
this.grid = grid;
|
| 209 |
+
this.containerId = containerId;
|
| 210 |
+
this.initMassactionElements();
|
| 211 |
+
|
| 212 |
+
this.checkedString = checkedValues;
|
| 213 |
+
this.formFieldName = formFieldName;
|
| 214 |
+
this.formFieldNameInternal = formFieldNameInternal;
|
| 215 |
+
|
| 216 |
+
this.grid.initCallback = this.onGridInit.bind(this);
|
| 217 |
+
this.grid.preInitCallback = this.onGridPreInit.bind(this);
|
| 218 |
+
this.grid.initRowCallback = this.onGridRowInit.bind(this);
|
| 219 |
+
this.grid.rowClickCallback = this.onGridRowClick.bind(this);
|
| 220 |
+
this.initCheckboxes();
|
| 221 |
+
this.checkCheckboxes();
|
| 222 |
+
// MAGE -- end
|
| 223 |
+
|
| 224 |
+
// TBT -- enhanced grid -- begin
|
| 225 |
+
this.grid.multiSelectFunction = this.onMultiSelect.bind(this);
|
| 226 |
+
//this.selectedRows = false;
|
| 227 |
+
|
| 228 |
+
if(checkedValues != "") {
|
| 229 |
+
checkedValues.each(function(item){
|
| 230 |
+
this.checkedValues[item] = item;
|
| 231 |
+
}.bind(this));
|
| 232 |
+
}
|
| 233 |
+
};
|
| 234 |
+
// Multiselect
|
| 235 |
+
varienGridMassaction.prototype.onMultiSelect = function(events) {
|
| 236 |
+
this.grid.onMultiSelect(events);
|
| 237 |
+
var checkValues = new Array();
|
| 238 |
+
var uncheckValues = new Array();
|
| 239 |
+
for(rowid in events) {
|
| 240 |
+
var checkVal = events[rowid].checkbox.value;
|
| 241 |
+
if(events[rowid].checkbox.checked) {
|
| 242 |
+
checkValues.push(checkVal);
|
| 243 |
+
this.checkedString = varienStringArray.add(checkVal, this.checkedString);
|
| 244 |
+
} else {
|
| 245 |
+
uncheckValues.push(checkVal);
|
| 246 |
+
this.checkedString = varienStringArray.remove(checkVal, this.checkedString);
|
| 247 |
+
}
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
this.updateCount();
|
| 251 |
+
};
|
| 252 |
+
varienGridMassaction.prototype.apply = function() {
|
| 253 |
+
var item = this.getSelectedItem();
|
| 254 |
+
if(!item) {
|
| 255 |
+
this.validator.validate();
|
| 256 |
+
return;
|
| 257 |
+
}
|
| 258 |
+
this.currentItem = item;
|
| 259 |
+
|
| 260 |
+
var fieldName = "";
|
| 261 |
+
if (item.field == undefined) {
|
| 262 |
+
fieldName = this.formFieldName
|
| 263 |
+
}
|
| 264 |
+
fieldName += '[]';
|
| 265 |
+
|
| 266 |
+
var fieldsHtml = '';
|
| 267 |
+
var callbackVal = null;
|
| 268 |
+
var multiFields = item.fields;
|
| 269 |
+
|
| 270 |
+
if(this.currentItem.callback) {
|
| 271 |
+
callbackVal = eval(this.currentItem.callback.replace("{checkedValues}", "'"+ this.getCheckedValues()+"'"));
|
| 272 |
+
if (callbackVal == null) {
|
| 273 |
+
return;
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
var formCallbackVal = document.createElement('input');
|
| 277 |
+
formCallbackVal.type = "hidden";
|
| 278 |
+
formCallbackVal.value = callbackVal;
|
| 279 |
+
formCallbackVal.name = "callbackval";
|
| 280 |
+
this.form.appendChild(formCallbackVal);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
if(this.currentItem.confirm && !window.confirm(this.currentItem.confirm)) {
|
| 284 |
+
return;
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
/* Maybe in future
|
| 288 |
+
this.getOnlyExistsCheckedValues().each(function(item){
|
| 289 |
+
fieldsHtml += this.fieldTemplate.evaluate({name: fieldName, value: item});
|
| 290 |
+
}.bind(this)); */
|
| 291 |
+
|
| 292 |
+
this.getCheckedValues().split(",").each(function(item){
|
| 293 |
+
if(multiFields != null) {
|
| 294 |
+
for (var i=0; i<multiFields.length; i++) {
|
| 295 |
+
fieldsHtml += this.fieldTemplate.evaluate({name: multiFields[i]+'[]', value: item});
|
| 296 |
+
}
|
| 297 |
+
} else {
|
| 298 |
+
fieldsHtml += this.fieldTemplate.evaluate({name: fieldName, value: item});
|
| 299 |
+
}
|
| 300 |
+
}.bind(this));
|
| 301 |
+
this.formHiddens.update(fieldsHtml);
|
| 302 |
+
|
| 303 |
+
if(!this.validator.validate()) {
|
| 304 |
+
return;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
if(this.useAjax && item.url) {
|
| 309 |
+
new Ajax.Request(item.url, {
|
| 310 |
+
'method': 'post',
|
| 311 |
+
'parameters': this.form.serialize(true),
|
| 312 |
+
'onComplete': this.onMassactionComplete.bind(this)
|
| 313 |
+
});
|
| 314 |
+
} else if(item.url) {
|
| 315 |
+
this.form.action = item.url;
|
| 316 |
+
this.form.submit();
|
| 317 |
+
}
|
| 318 |
+
};
|
| 319 |
+
varienGridMassaction.prototype.walkSelectedRows = function(walkFunction, warningLimit) {
|
| 320 |
+
if(warningLimit == undefined) warningLimit = 100;
|
| 321 |
+
var selectedRowCount = 0;
|
| 322 |
+
var abort = false;
|
| 323 |
+
this.grid.rows.each(function(ie) {
|
| 324 |
+
var rcheckboxs = ie.getElementsBySelector('input[type=checkbox]').each(function(chk) {
|
| 325 |
+
if(chk.checked) {
|
| 326 |
+
if(abort) return;
|
| 327 |
+
walkFunction(ie); //user function
|
| 328 |
+
|
| 329 |
+
// checks for abort.
|
| 330 |
+
selectedRowCount++;
|
| 331 |
+
if(selectedRowCount == warningLimit) {
|
| 332 |
+
if(!window.confirm("There are over 100 rows processing, should the script continue?")) {
|
| 333 |
+
abort = true;
|
| 334 |
+
}
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
});
|
| 338 |
+
});
|
| 339 |
+
}
|
| 340 |
+
varienGrid.prototype.doFilter = function(){
|
| 341 |
+
var filters = $$('#'+this.containerId+' .filter input', '#'+this.containerId+' .filter select');
|
| 342 |
+
var searchQry = $$('#'+this.containerId+' .filter input', '#'+this.containerId+' .filter select');
|
| 343 |
+
var elements = [];
|
| 344 |
+
for(var i in filters){
|
| 345 |
+
if(filters[i].value && filters[i].value.length) elements.push(filters[i]);
|
| 346 |
+
}
|
| 347 |
+
if (!this.doFilterCallback || (this.doFilterCallback && this.doFilterCallback())) {
|
| 348 |
+
this.addVarToUrl('q', $$('input#enhancedGridSearchQry')[0].value);
|
| 349 |
+
this.reload(this.addVarToUrl(this.filterVar, encode_base64(Form.serializeElements(elements))));
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
varienGrid.prototype.resetFilter = function(){
|
| 353 |
+
this.addVarToUrl('q', '')
|
| 354 |
+
this.addVarToUrl(this.filterVar, '')
|
| 355 |
+
this.reload();
|
| 356 |
+
}
|
js/tbt/enhancedgrid/resources/css/enhancedgrid.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
.grid tr.multiselect, .grid tr.multiselect tr { background:#CCF0F0 !important; }
|
package.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>TBT_Enhancedgrid</name>
|
| 4 |
+
<version>1.0</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>First beta release.</notes>
|
| 12 |
+
<authors><author><name>Jay</name><user>auto-converted</user><email>najibkaake@gmail.com</email></author></authors>
|
| 13 |
+
<date>2009-01-06</date>
|
| 14 |
+
<time>06:38:50</time>
|
| 15 |
+
<contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="tbt_enhancedgrid.xml" hash="e19d259d6df5dadd9ffdc2dc4e9c7977"/></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="729afeb31499be3f3d8793d8a534040b"/></dir><dir name="resources"><dir name="css"><file name="enhancedgrid.css" hash="a219b0e656329f2407835dbe346f81d3"/></dir></dir><file name="egsupplemental.js" hash="93289d37aad390e8faead0e7c1dcaab8"/><file name="enhancedgrid.js" hash="594bdcbf09ac73970cbadb11b72842e5"/></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="9dd6640aa9c3ad0f274cb805ad6141e3"/></dir><file name="Product.php" hash="ec3358b2254c1b6448cf6f89ae632a46"/></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="70de17f8f9231776508f3b1b7b9fb8e5"/></dir></dir><dir name="etc"><file name="config.xml" hash="39859b2abf19be405437433613bf1411"/><file name="system.xml" hash="c586c2f771c2cde39eddc6767524297e"/></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>
|
