Advertisement
Guest User

Untitled

a guest
Aug 10th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. <?php
  2. class TBF_Cupom_Block_Adminhtml_Gerados_Index_Grid extends Mage_Adminhtml_Block_Widget_Form_Container
  3. //Mage_Adminhtml_Block_Widget_Grid
  4. {
  5.     public function __construct()
  6.     {
  7.         parent::__construct();
  8.         $this->_removeButton('add');
  9.  
  10.         // Set some defaults for our grid
  11.         $this->setDefaultSort('id');
  12.         $this->setId('foo_bar_index_grid');
  13.         $this->setDefaultDir('asc');
  14.         $this->setSaveParametersInSession(true);
  15.     }
  16.  
  17.     protected function _getCollectionClass()
  18.     {
  19.         // This is the model we are using for the grid
  20.         return 'foo/bar_collection';
  21.     }
  22.  
  23.     protected function _prepareCollection()
  24.     {
  25.         // Get and set our collection for the grid
  26.         $collection = Mage::getResourceModel($this->_getCollectionClass());
  27.         $this->setCollection($collection);
  28.         return parent::_prepareCollection();
  29.     }
  30.  
  31.     protected function _prepareColumns()
  32.     {
  33.         // Add the columns that should appear in the grid
  34.         $this->addColumn('id',
  35.             array(
  36.                 'header'=> $this->__('ID'),
  37.                 'align' =>'right',
  38.                 'width' => '50px',
  39.                 'index' => 'id'
  40.             )
  41.         );
  42.  
  43.         $this->addColumn('name',
  44.             array(
  45.                 'header'=> $this->__('Name'),
  46.                 'index' => 'name'
  47.             )
  48.         );
  49.         return parent::_prepareColumns();
  50.     }
  51.  
  52.     public function getRowUrl($row)
  53.     {
  54.         // This is where our row data will link to
  55.         return $this->getUrl('*/*/edit', array('id' => $row->getId()));
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement