1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Promo_Quote_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: 37: 38: 39:
40: public function __construct()
41: {
42: parent::__construct();
43: $this->setId('promo_quote_grid');
44: $this->setDefaultSort('sort_order');
45: $this->setDefaultDir('ASC');
46: $this->setSaveParametersInSession(true);
47: }
48:
49: 50: 51: 52: 53: 54:
55: protected function _prepareCollection()
56: {
57:
58: $collection = Mage::getModel('salesrule/rule')
59: ->getResourceCollection();
60: $collection->addWebsitesToResult();
61: $this->setCollection($collection);
62:
63: parent::_prepareCollection();
64: return $this;
65: }
66:
67: 68: 69: 70: 71:
72: protected function _prepareColumns()
73: {
74: $this->addColumn('rule_id', array(
75: 'header' => Mage::helper('salesrule')->__('ID'),
76: 'align' =>'right',
77: 'width' => '50px',
78: 'index' => 'rule_id',
79: ));
80:
81: $this->addColumn('name', array(
82: 'header' => Mage::helper('salesrule')->__('Rule Name'),
83: 'align' =>'left',
84: 'index' => 'name',
85: ));
86:
87: $this->addColumn('coupon_code', array(
88: 'header' => Mage::helper('salesrule')->__('Coupon Code'),
89: 'align' => 'left',
90: 'width' => '150px',
91: 'index' => 'code',
92: ));
93:
94: $this->addColumn('from_date', array(
95: 'header' => Mage::helper('salesrule')->__('Date Start'),
96: 'align' => 'left',
97: 'width' => '120px',
98: 'type' => 'date',
99: 'index' => 'from_date',
100: ));
101:
102: $this->addColumn('to_date', array(
103: 'header' => Mage::helper('salesrule')->__('Date Expire'),
104: 'align' => 'left',
105: 'width' => '120px',
106: 'type' => 'date',
107: 'default' => '--',
108: 'index' => 'to_date',
109: ));
110:
111: $this->addColumn('is_active', array(
112: 'header' => Mage::helper('salesrule')->__('Status'),
113: 'align' => 'left',
114: 'width' => '80px',
115: 'index' => 'is_active',
116: 'type' => 'options',
117: 'options' => array(
118: 1 => 'Active',
119: 0 => 'Inactive',
120: ),
121: ));
122:
123: if (!Mage::app()->isSingleStoreMode()) {
124: $this->addColumn('rule_website', array(
125: 'header' => Mage::helper('salesrule')->__('Website'),
126: 'align' =>'left',
127: 'index' => 'website_ids',
128: 'type' => 'options',
129: 'sortable' => false,
130: 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(),
131: 'width' => 200,
132: ));
133: }
134:
135: $this->addColumn('sort_order', array(
136: 'header' => Mage::helper('salesrule')->__('Priority'),
137: 'align' => 'right',
138: 'index' => 'sort_order',
139: 'width' => 100,
140: ));
141:
142: parent::_prepareColumns();
143: return $this;
144: }
145:
146: 147: 148: 149: 150: 151: 152:
153: public function getRowUrl($row)
154: {
155: return $this->getUrl('*/*/edit', array('id' => $row->getRuleId()));
156: }
157:
158: }
159: