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_Sales_Transactions_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: 37: 38: 39:
40: public function __construct()
41: {
42: parent::__construct();
43: $this->setId('order_transactions');
44: $this->setUseAjax(true);
45: $this->setDefaultSort('created_at');
46: $this->setDefaultDir('DESC');
47: $this->setSaveParametersInSession(true);
48: }
49:
50: 51: 52: 53: 54:
55: protected function _prepareCollection()
56: {
57: $collection = ($this->getCollection())
58: ? $this->getCollection() : Mage::getResourceModel('sales/order_payment_transaction_collection');
59: $order = Mage::registry('current_order');
60: if ($order) {
61: $collection->addOrderIdFilter($order->getId());
62: }
63: $collection->addOrderInformation(array('increment_id'));
64: $collection->addPaymentInformation(array('method'));
65: $this->setCollection($collection);
66: return parent::_prepareCollection();
67: }
68:
69: 70: 71: 72: 73:
74: protected function _prepareColumns()
75: {
76: $this->addColumn('transaction_id', array(
77: 'header' => Mage::helper('sales')->__('ID #'),
78: 'index' => 'transaction_id',
79: 'type' => 'number'
80: ));
81:
82: $this->addColumn('increment_id', array(
83: 'header' => Mage::helper('sales')->__('Order ID'),
84: 'index' => 'increment_id',
85: 'type' => 'text'
86: ));
87:
88: $this->addColumn('txn_id', array(
89: 'header' => Mage::helper('sales')->__('Transaction ID'),
90: 'index' => 'txn_id',
91: 'type' => 'text'
92: ));
93:
94: $this->addColumn('parent_txn_id', array(
95: 'header' => Mage::helper('sales')->__('Parent Transaction ID'),
96: 'index' => 'parent_txn_id',
97: 'type' => 'text'
98: ));
99:
100: $this->addColumn('method', array(
101: 'header' => Mage::helper('sales')->__('Payment Method Name'),
102: 'index' => 'method',
103: 'type' => 'options',
104: 'options' => Mage::helper('payment')->getPaymentMethodList(true),
105: 'option_groups' => Mage::helper('payment')->getPaymentMethodList(true, true, true),
106: ));
107:
108: $this->addColumn('txn_type', array(
109: 'header' => Mage::helper('sales')->__('Transaction Type'),
110: 'index' => 'txn_type',
111: 'type' => 'options',
112: 'options' => Mage::getSingleton('sales/order_payment_transaction')->getTransactionTypes()
113: ));
114:
115: $this->addColumn('is_closed', array(
116: 'header' => Mage::helper('sales')->__('Is Closed'),
117: 'index' => 'is_closed',
118: 'width' => 1,
119: 'type' => 'options',
120: 'align' => 'center',
121: 'options' => array(
122: 1 => Mage::helper('sales')->__('Yes'),
123: 0 => Mage::helper('sales')->__('No'),
124: )
125: ));
126:
127: $this->addColumn('created_at', array(
128: 'header' => Mage::helper('sales')->__('Created At'),
129: 'index' => 'created_at',
130: 'width' => 1,
131: 'type' => 'datetime',
132: 'align' => 'center',
133: 'default' => $this->__('N/A'),
134: 'html_decorators' => array('nobr')
135: ));
136:
137: return parent::_prepareColumns();
138: }
139:
140: 141: 142: 143: 144:
145: public function getGridUrl()
146: {
147: return $this->getUrl('*/*/grid', array('_current' => true));
148: }
149:
150: 151: 152: 153: 154:
155: public function getRowUrl($item)
156: {
157: return $this->getUrl('*/*/view', array('txn_id' => $item->getId()));
158: }
159: }
160: