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_View_Wishlist extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: 37: 38: 39: 40:
41: public function __construct()
42: {
43: parent::__construct();
44: $this->setId('customer_view_wishlist_grid');
45: $this->setSortable(false);
46: $this->setPagerVisibility(false);
47: $this->setFilterVisibility(false);
48: $this->setEmptyText(Mage::helper('customer')->__("There are no items in customer's wishlist at the moment"));
49: }
50:
51: 52: 53: 54: 55:
56: protected function _prepareCollection()
57: {
58: $collection = Mage::getModel('wishlist/item')->getCollection()
59: ->addCustomerIdFilter(Mage::registry('current_customer')->getId())
60: ->addDaysInWishlist(true)
61: ->addStoreData()
62: ->setInStockFilter(true);
63:
64: $this->setCollection($collection);
65:
66: return parent::_prepareCollection();
67: }
68:
69: 70: 71: 72: 73:
74: protected function _prepareColumns()
75: {
76: $this->addColumn('product_id', array(
77: 'header' => Mage::helper('customer')->__('Product ID'),
78: 'index' => 'product_id',
79: 'type' => 'number',
80: 'width' => '100px'
81: ));
82:
83: $this->addColumn('product_name', array(
84: 'header' => Mage::helper('customer')->__('Product Name'),
85: 'index' => 'product_name',
86: 'renderer' => 'adminhtml/customer_edit_tab_view_grid_renderer_item'
87: ));
88:
89: if (!Mage::app()->isSingleStoreMode()) {
90: $this->addColumn('store', array(
91: 'header' => Mage::helper('customer')->__('Added From'),
92: 'index' => 'store_id',
93: 'type' => 'store',
94: 'width' => '160px',
95: ));
96: }
97:
98: $this->addColumn('added_at', array(
99: 'header' => Mage::helper('customer')->__('Date Added'),
100: 'index' => 'added_at',
101: 'type' => 'date',
102: 'width' => '140px',
103: ));
104:
105: $this->addColumn('days', array(
106: 'header' => Mage::helper('customer')->__('Days in Wishlist'),
107: 'index' => 'days_in_wishlist',
108: 'type' => 'number',
109: 'width' => '140px',
110: ));
111:
112: return parent::_prepareColumns();
113: }
114:
115: 116: 117: 118: 119:
120: public function ()
121: {
122: return ($this->getCollection()->getSize() > 0);
123: }
124:
125: 126: 127: 128: 129: 130:
131: public function getRowUrl($row)
132: {
133: return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
134: }
135: }
136: