00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Customer_Edit_Tab_View_Wishlist extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('customer_view_wishlist_grid');
00041 $this->setSortable(false);
00042 $this->setPagerVisibility(false);
00043 $this->setFilterVisibility(false);
00044 $this->setEmptyText(Mage::helper('customer')->__("There are no items in customer's wishlist at the moment"));
00045 }
00046
00047 protected function _prepareCollection()
00048 {
00049 $collection = Mage::getModel('wishlist/wishlist')->loadByCustomer(Mage::registry('current_customer'))
00050 ->getProductCollection()
00051 ->addAttributeToSelect('name')
00052 ->addStoreData();
00053
00054 $this->setCollection($collection);
00055
00056 return parent::_prepareCollection();
00057 }
00058
00059 protected function _prepareColumns()
00060 {
00061 $this->addColumn('product_id', array(
00062 'header' => Mage::helper('customer')->__('Product ID'),
00063 'index' => 'product_id',
00064 'type' => 'number',
00065 'width' => '100px'
00066 ));
00067
00068 $this->addColumn('product_name', array(
00069 'header' => Mage::helper('customer')->__('Product Name'),
00070 'index' => 'name'
00071 ));
00072
00073 if (!Mage::app()->isSingleStoreMode()) {
00074 $this->addColumn('store', array(
00075 'header' => Mage::helper('customer')->__('Added From'),
00076 'index' => 'store_id',
00077 'type' => 'store',
00078 'width' => '160px',
00079 ));
00080 }
00081
00082 $this->addColumn('added_at', array(
00083 'header' => Mage::helper('customer')->__('Date Added'),
00084 'index' => 'added_at',
00085 'type' => 'date',
00086 'width' => '140px',
00087 ));
00088
00089 $this->addColumn('days', array(
00090 'header' => Mage::helper('customer')->__('Days in Wishlist'),
00091 'index' => 'days_in_wishlist',
00092 'type' => 'number',
00093 'width' => '140px',
00094 ));
00095
00096 return parent::_prepareColumns();
00097 }
00098
00099 public function getHeadersVisibility()
00100 {
00101 return ($this->getCollection()->getSize() > 0);
00102 }
00103
00104 public function getRowUrl($row)
00105 {
00106 return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
00107 }
00108
00109 }
00110