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
00035 class Mage_Adminhtml_Block_Promo_Quote_Grid extends Mage_Adminhtml_Block_Widget_Grid
00036 {
00037
00038 public function __construct()
00039 {
00040 parent::__construct();
00041 $this->setId('promo_quote_grid');
00042 $this->setDefaultSort('sort_order');
00043 $this->setDefaultDir('ASC');
00044 $this->setSaveParametersInSession(true);
00045 }
00046
00047 protected function _prepareCollection()
00048 {
00049 $collection = Mage::getModel('salesrule/rule')
00050 ->getResourceCollection();
00051 $this->setCollection($collection);
00052 return parent::_prepareCollection();
00053 }
00054
00055 protected function _prepareColumns()
00056 {
00057 $this->addColumn('rule_id', array(
00058 'header' => Mage::helper('salesrule')->__('ID'),
00059 'align' =>'right',
00060 'width' => '50px',
00061 'index' => 'rule_id',
00062 ));
00063
00064 $this->addColumn('name', array(
00065 'header' => Mage::helper('salesrule')->__('Rule Name'),
00066 'align' =>'left',
00067 'index' => 'name',
00068 ));
00069
00070 $this->addColumn('coupon_code', array(
00071 'header' => Mage::helper('salesrule')->__('Coupon Code'),
00072 'align' => 'left',
00073 'width' => '150px',
00074 'index' => 'coupon_code',
00075 ));
00076
00077 $this->addColumn('from_date', array(
00078 'header' => Mage::helper('salesrule')->__('Date Start'),
00079 'align' => 'left',
00080 'width' => '120px',
00081 'type' => 'date',
00082 'index' => 'from_date',
00083 ));
00084
00085 $this->addColumn('to_date', array(
00086 'header' => Mage::helper('salesrule')->__('Date Expire'),
00087 'align' => 'left',
00088 'width' => '120px',
00089 'type' => 'date',
00090 'default' => '--',
00091 'index' => 'to_date',
00092 ));
00093
00094 $this->addColumn('is_active', array(
00095 'header' => Mage::helper('salesrule')->__('Status'),
00096 'align' => 'left',
00097 'width' => '80px',
00098 'index' => 'is_active',
00099 'type' => 'options',
00100 'options' => array(
00101 1 => 'Active',
00102 0 => 'Inactive',
00103 ),
00104 ));
00105
00106 $this->addColumn('sort_order', array(
00107 'header' => Mage::helper('salesrule')->__('Priority'),
00108 'align' => 'right',
00109 'index' => 'sort_order',
00110 ));
00111
00112 return parent::_prepareColumns();
00113 }
00114
00115 public function getRowUrl($row)
00116 {
00117 return $this->getUrl('*/*/edit', array('id' => $row->getRuleId()));
00118 }
00119
00120 }