Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. <?php
  2.  
  3. class Sigmasolve_Makemodel_Block_Adminhtml_Makemodel_Grid extends Mage_Adminhtml_Block_Widget_Grid
  4. {
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. $this->setId('makemodelGrid');
  9. // This is the primary key of the database
  10. $this->setDefaultSort('id');
  11. $this->setDefaultDir('ASC');
  12. $this->setSaveParametersInSession(true);
  13. $this->setUseAjax(true);
  14. }
  15.  
  16. protected function _prepareMassaction()
  17. {
  18. $this->setMassactionIdField('id');
  19. $this->getMassactionBlock()->setFormFieldName('makemodel');
  20.  
  21. $this->getMassactionBlock()->addItem('delete', array(
  22. 'label' => Mage::helper('makemodel')->__('Delete'),
  23. 'url' => $this->getUrl('*/*/massDelete', array('' => '')),
  24. 'confirm' => Mage::helper('makemodel')->__('Are you sure?')
  25. ));
  26.  
  27. //$statuses = Mage::getSingleton('makemodel/status')->getOptionArray();
  28.  
  29. // array_unshift($statuses, array('label'=>'', 'value'=>''));
  30. // $this->getMassactionBlock()->addItem('status', array(
  31. // 'label'=> Mage::helper('makemodel')->__('Change status'),
  32. // 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
  33. // 'additional' => array(
  34. // 'visibility' => array(
  35. // 'name' => 'status',
  36. // 'type' => 'select',
  37. // 'class' => 'required-entry',
  38. // 'label' => Mage::helper('makemodel')->__('Status'),
  39. // 'values' => $statuse
  40. //)
  41. //)
  42. // ));
  43. return $this;
  44. }
  45.  
  46. protected function _prepareCollection()
  47. {
  48. $collection = Mage::getModel('makemodel/makemodel')->getCollection();
  49. $this->setCollection($collection);
  50. return parent::_prepareCollection();
  51. }
  52.  
  53. protected function _prepareColumns()
  54. {
  55. $this->addColumn('id', array(
  56. 'header' => Mage::helper('makemodel')->__('ID'),
  57. 'align' =>'right',
  58. 'width' => '50px',
  59. 'index' => 'id',
  60. ));
  61.  
  62. $this->addColumn('ktyp', array(
  63. 'header' => Mage::helper('makemodel')->__('Ktyp'),
  64. 'align' =>'left',
  65. 'index' => 'ktyp',
  66. ));
  67.  
  68. $this->addColumn('manufacturer', array(
  69. 'header' => Mage::helper('makemodel')->__('Manufacturer'),
  70. 'align' =>'left',
  71. 'index' => 'manufacturer',
  72. ));
  73.  
  74. $this->addColumn('model', array(
  75. 'header' => Mage::helper('makemodel')->__('Model'),
  76. 'align' =>'left',
  77. 'index' => 'model',
  78. ));
  79.  
  80. $this->addColumn('capacity', array(
  81. 'header' => Mage::helper('makemodel')->__('Capacity'),
  82. 'align' =>'left',
  83. 'index' => 'capacity',
  84. ));
  85.  
  86. $this->addColumn('year_from', array(
  87. 'header' => Mage::helper('makemodel')->__('Year_From'),
  88. 'align' =>'left',
  89. 'index' => 'year_from',
  90. ));
  91.  
  92. $this->addColumn('year_to', array(
  93. 'header' => Mage::helper('makemodel')->__('Year_To'),
  94. 'align' =>'left',
  95. 'index' => 'year_to',
  96. ));
  97.  
  98. $this->addColumn('fuel', array(
  99. 'header' => Mage::helper('makemodel')->__('Fuel'),
  100. 'align' =>'left',
  101. 'index' => 'fuel',
  102. ));
  103.  
  104.  
  105.  
  106. return parent::_prepareColumns();
  107. }
  108.  
  109.  
  110.  
  111. public function getRowUrl($row)
  112. {
  113. return $this->getUrl('*/*/edit', array('id' => $row->getId()));
  114. }
  115.  
  116. public function getGridUrl()
  117. {
  118. return $this->getUrl('*/*/grid', array('_current'=>true));
  119.  
  120. }
  121.  
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement