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: class Mage_Sales_Block_Adminhtml_Recurring_Profile_View_Tab_Orders
31: extends Mage_Adminhtml_Block_Widget_Grid
32: implements Mage_Adminhtml_Block_Widget_Tab_Interface
33: {
34: 35: 36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('recurring_profile_orders')
41: ->setUseAjax(true)
42: ->setSkipGenerateContent(true)
43: ;
44: }
45:
46: 47: 48: 49: 50:
51: protected function _prepareCollection()
52: {
53: $collection = Mage::getResourceModel('sales/order_grid_collection')
54: ->addRecurringProfilesFilter(Mage::registry('current_recurring_profile')->getId())
55: ;
56: $this->setCollection($collection);
57: return parent::_prepareCollection();
58: }
59:
60: 61: 62: 63: 64: 65: 66:
67: protected function _prepareColumns()
68: {
69: $this->addColumn('real_order_id', array(
70: 'header'=> Mage::helper('sales')->__('Order #'),
71: 'width' => '80px',
72: 'type' => 'text',
73: 'index' => 'increment_id',
74: ));
75:
76: if (!Mage::app()->isSingleStoreMode()) {
77: $this->addColumn('store_id', array(
78: 'header' => Mage::helper('sales')->__('Purchased From (Store)'),
79: 'index' => 'store_id',
80: 'type' => 'store',
81: 'store_view'=> true,
82: 'display_deleted' => true,
83: ));
84: }
85:
86: $this->addColumn('created_at', array(
87: 'header' => Mage::helper('sales')->__('Purchased On'),
88: 'index' => 'created_at',
89: 'type' => 'datetime',
90: 'width' => '100px',
91: ));
92:
93: $this->addColumn('billing_name', array(
94: 'header' => Mage::helper('sales')->__('Bill to Name'),
95: 'index' => 'billing_name',
96: ));
97:
98: $this->addColumn('shipping_name', array(
99: 'header' => Mage::helper('sales')->__('Ship to Name'),
100: 'index' => 'shipping_name',
101: ));
102:
103: $this->addColumn('base_grand_total', array(
104: 'header' => Mage::helper('sales')->__('G.T. (Base)'),
105: 'index' => 'base_grand_total',
106: 'type' => 'currency',
107: 'currency' => 'base_currency_code',
108: ));
109:
110: $this->addColumn('grand_total', array(
111: 'header' => Mage::helper('sales')->__('G.T. (Purchased)'),
112: 'index' => 'grand_total',
113: 'type' => 'currency',
114: 'currency' => 'order_currency_code',
115: ));
116:
117: $this->addColumn('status', array(
118: 'header' => Mage::helper('sales')->__('Status'),
119: 'index' => 'status',
120: 'type' => 'options',
121: 'width' => '70px',
122: 'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
123: ));
124:
125: if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
126: $this->addColumn('action',
127: array(
128: 'header' => Mage::helper('sales')->__('Action'),
129: 'width' => '50px',
130: 'type' => 'action',
131: 'getter' => 'getId',
132: 'actions' => array(
133: array(
134: 'caption' => Mage::helper('sales')->__('View'),
135: 'url' => array('base'=>'*/sales_order/view'),
136: 'field' => 'order_id'
137: )
138: ),
139: 'filter' => false,
140: 'sortable' => false,
141: 'index' => 'stores',
142: 'is_system' => true,
143: ));
144: }
145:
146: return parent::_prepareColumns();
147: }
148:
149: 150: 151: 152: 153: 154:
155: public function getRowUrl($row)
156: {
157: return $this->getUrl('*/sales_order/view', array('order_id' => $row->getId()));
158: }
159:
160: 161: 162: 163: 164:
165: public function getGridUrl()
166: {
167: return $this->getTabUrl();
168: }
169:
170: 171: 172: 173: 174:
175: public function getTabUrl()
176: {
177: return $this->getUrl('*/*/orders', array('profile' => Mage::registry('current_recurring_profile')->getId()));
178: }
179:
180: 181: 182: 183: 184:
185: public function getTabClass()
186: {
187: return 'ajax';
188: }
189:
190: 191: 192: 193: 194:
195: public function getTabLabel()
196: {
197: return Mage::helper('sales')->__('Related Orders');
198: }
199:
200: 201: 202: 203: 204:
205: public function getTabTitle()
206: {
207: return $this->getTabLabel();
208: }
209:
210: 211: 212:
213: public function canShowTab()
214: {
215: return true;
216: }
217:
218: 219: 220:
221: public function isHidden()
222: {
223: return false;
224: }
225: }
226: