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_Customer_Edit_Tab_Tags extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('ordersGrid');
41: $this->setUseAjax(true);
42: }
43:
44: protected function _prepareCollection()
45: {
46: $collection = Mage::getResourceModel('customer/customer_collection')
47: ->addNameToSelect()
48: ->addAttributeToSelect('email')
49: ->addAttributeToSelect('created_at')
50: ->joinAttribute('billing_postcode', 'customer_address/postcode', 'default_billing')
51: ->joinAttribute('billing_city', 'customer_address/city', 'default_billing')
52: ->joinAttribute('billing_telephone', 'customer_address/telephone', 'default_billing')
53: ->joinAttribute('billing_country_id', 'customer_address/country_id', 'default_billing');
54:
55: $this->setCollection($collection);
56:
57: return parent::_prepareCollection();
58: }
59:
60: protected function _prepareColumns()
61: {
62: $this->addColumn('entity_id', array(
63: 'header' => Mage::helper('customer')->__('ID'),
64: 'width' =>5,
65: 'align' =>'center',
66: 'sortable' =>true,
67: 'index' =>'entity_id'
68: ));
69: $this->addColumn('name', array(
70: 'header' => Mage::helper('customer')->__('Name'),
71: 'index' =>'name'
72: ));
73: $this->addColumn('email', array(
74: 'header' => Mage::helper('customer')->__('Email'),
75: 'width' =>40,
76: 'align' =>'center',
77: 'index' =>'email'
78: ));
79: $this->addColumn('telephone', array(
80: 'header' => Mage::helper('customer')->__('Telephone'),
81: 'align' =>'center',
82: 'index' =>'billing_telephone'
83: ));
84: $this->addColumn('billing_postcode', array(
85: 'header' => Mage::helper('customer')->__('ZIP/Post Code'),
86: 'index' =>'billing_postcode',
87: ));
88: $this->addColumn('billing_country_id', array(
89: 'header' => Mage::helper('customer')->__('Country'),
90: 'type' => 'country',
91: 'index' => 'billing_country_id',
92: ));
93: $this->addColumn('customer_since', array(
94: 'header' => Mage::helper('customer')->__('Customer Since'),
95: 'type' => 'date',
96: 'format' => 'Y.m.d',
97: 'index' =>'created_at',
98: ));
99: $this->addColumn('action', array(
100: 'header' => Mage::helper('customer')->__('Action'),
101: 'align' =>'center',
102: 'format' =>'<a href="'.$this->getUrl('*/sales/edit/id/$entity_id').'">'.Mage::helper('customer')->__('Edit').'</a>',
103: 'filter' =>false,
104: 'sortable' =>false,
105: 'is_system' =>true
106: ));
107:
108: $this->setColumnFilter('entity_id')
109: ->setColumnFilter('email')
110: ->setColumnFilter('name');
111:
112: $this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
113: $this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
114: return parent::_prepareColumns();
115: }
116:
117: public function getGridUrl()
118: {
119: return $this->getUrl('*/*/index', array('_current'=>true));
120: }
121:
122: }
123: