00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Catalog_Product_Attribute_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('attributeGrid');
00041 $this->setDefaultSort('attribute_code');
00042 $this->setDefaultDir('ASC');
00043 }
00044
00045 protected function _prepareCollection()
00046 {
00047 $collection = Mage::getResourceModel('eav/entity_attribute_collection')
00048 ->setEntityTypeFilter( Mage::getModel('eav/entity')->setType('catalog_product')->getTypeId() )
00049 ->addVisibleFilter();
00050 $this->setCollection($collection);
00051
00052 return parent::_prepareCollection();
00053 }
00054
00055 protected function _prepareColumns()
00056 {
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 $this->addColumn('attribute_code', array(
00068 'header'=>Mage::helper('catalog')->__('Attribute Code'),
00069 'sortable'=>true,
00070 'index'=>'attribute_code'
00071 ));
00072
00073 $this->addColumn('frontend_label', array(
00074 'header'=>Mage::helper('catalog')->__('Attribute Label'),
00075 'sortable'=>true,
00076 'index'=>'frontend_label'
00077 ));
00078
00079 $this->addColumn('is_visible', array(
00080 'header'=>Mage::helper('catalog')->__('Visible'),
00081 'sortable'=>true,
00082 'index'=>'is_visible_on_front',
00083 'type' => 'options',
00084 'options' => array(
00085 '1' => Mage::helper('catalog')->__('Yes'),
00086 '0' => Mage::helper('catalog')->__('No'),
00087 ),
00088 'align' => 'center',
00089 ));
00090
00091 $this->addColumn('is_global', array(
00092 'header'=>Mage::helper('catalog')->__('Scope'),
00093 'sortable'=>true,
00094 'index'=>'is_global',
00095 'type' => 'options',
00096 'options' => array(
00097 Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE =>Mage::helper('catalog')->__('Store View'),
00098 Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE =>Mage::helper('catalog')->__('Website'),
00099 Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL =>Mage::helper('catalog')->__('Global'),
00100 ),
00101 'align' => 'center',
00102 ));
00103
00104 $this->addColumn('is_required', array(
00105 'header'=>Mage::helper('catalog')->__('Required'),
00106 'sortable'=>true,
00107 'index'=>'is_required',
00108 'type' => 'options',
00109 'options' => array(
00110 '1' => Mage::helper('catalog')->__('Yes'),
00111 '0' => Mage::helper('catalog')->__('No'),
00112 ),
00113 'align' => 'center',
00114 ));
00115
00116 $this->addColumn('is_user_defined', array(
00117 'header'=>Mage::helper('catalog')->__('System'),
00118 'sortable'=>true,
00119 'index'=>'is_user_defined',
00120 'type' => 'options',
00121 'align' => 'center',
00122 'options' => array(
00123 '0' => Mage::helper('catalog')->__('Yes'),
00124 '1' => Mage::helper('catalog')->__('No'),
00125 ),
00126 ));
00127
00128 $this->addColumn('is_searchable', array(
00129 'header'=>Mage::helper('catalog')->__('Searchable'),
00130 'sortable'=>true,
00131 'index'=>'is_searchable',
00132 'type' => 'options',
00133 'options' => array(
00134 '1' => Mage::helper('catalog')->__('Yes'),
00135 '0' => Mage::helper('catalog')->__('No'),
00136 ),
00137 'align' => 'center',
00138 ));
00139
00140 $this->addColumn('is_filterable', array(
00141 'header'=>Mage::helper('catalog')->__('Use In Layered Navigation'),
00142 'sortable'=>true,
00143 'index'=>'is_filterable',
00144 'type' => 'options',
00145 'options' => array(
00146 '1' => Mage::helper('catalog')->__('Filterable (with results)'),
00147 '2' => Mage::helper('catalog')->__('Filterable (no results)'),
00148 '0' => Mage::helper('catalog')->__('No'),
00149 ),
00150 'align' => 'center',
00151 ));
00152
00153 $this->addColumn('is_comparable', array(
00154 'header'=>Mage::helper('catalog')->__('Comparable'),
00155 'sortable'=>true,
00156 'index'=>'is_comparable',
00157 'type' => 'options',
00158 'options' => array(
00159 '1' => Mage::helper('catalog')->__('Yes'),
00160 '0' => Mage::helper('catalog')->__('No'),
00161 ),
00162 'align' => 'center',
00163 ));
00164
00165 return parent::_prepareColumns();
00166 }
00167
00168 public function getRowUrl($row)
00169 {
00170 return $this->getUrl('*/*/edit', array('attribute_id' => $row->getAttributeId()));
00171 }
00172
00173 }