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
00035 class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Tag_Customer extends Mage_Adminhtml_Block_Widget_Grid
00036 {
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('tag_customers_grid');
00041 $this->setDefaultSort('firstname');
00042 $this->setDefaultDir('ASC');
00043 $this->setUseAjax(true);
00044 }
00045
00046 protected function _prepareCollection()
00047 {
00048 $tagId = Mage::registry('tagId');
00049 $collection = Mage::getModel('tag/tag')
00050 ->getCustomerCollection()
00051 ->addProductFilter($this->getProductId())
00052 ->addGroupByTag();
00053
00054 $this->setCollection($collection);
00055 return parent::_prepareCollection();
00056 }
00057
00058 protected function _afterLoadCollection()
00059 {
00060 return parent::_afterLoadCollection();
00061 }
00062
00063 protected function _prepareColumns()
00064 {
00065 $this->addColumn('firstname', array(
00066 'header' => Mage::helper('catalog')->__('First Name'),
00067 'index' => 'firstname',
00068 ));
00069
00070 $this->addColumn('lastname', array(
00071 'header' => Mage::helper('catalog')->__('Last Name'),
00072 'index' => 'lastname',
00073 ));
00074
00075 $this->addColumn('email', array(
00076 'header' => Mage::helper('catalog')->__('Email'),
00077 'index' => 'email',
00078 ));
00079
00080 $this->addColumn('name', array(
00081 'header' => Mage::helper('catalog')->__('Tag Name'),
00082 'index' => 'name',
00083 ));
00084
00085 return parent::_prepareColumns();
00086 }
00087
00088 protected function getRowUrl($row)
00089 {
00090 return $this->getUrl('*/tag/edit', array(
00091 'tag_id' => $row->getTagId(),
00092 'product_id' => $this->getProductId(),
00093 ));
00094 }
00095
00096 public function getGridUrl()
00097 {
00098 return $this->getUrl('*/catalog_product/tagCustomerGrid', array(
00099 '_current' => true,
00100 'id' => $this->getProductId(),
00101 'product_id' => $this->getProductId(),
00102 ));
00103 }
00104 }