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_Tag_Grid_Products extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 protected function _prepareCollection()
00038 {
00039 $collection = Mage::getResourceModel('tag/product_collection')
00040 ->addAttributeToSelect('sku')
00041 ->addAttributeToSelect('name')
00042 ;
00043 if ($tagId = $this->getRequest()->getParam('tag_id')) {
00044 $collection->addTagFilter($tagId);
00045 }
00046 if ($customerId = $this->getRequest()->getParam('customer_id')) {
00047 $collection->addCustomerFilter($customerId);
00048 }
00049 $this->setCollection($collection);
00050
00051 return parent::_prepareCollection();
00052 }
00053
00054 protected function _prepareColumns()
00055 {
00056 $this->addColumn('product_id', array(
00057 'header' => Mage::helper('tag')->__('ID'),
00058 'align' => 'center',
00059 'width' => '60px',
00060 'sortable' => false,
00061 'index' => 'product_id'
00062 ));
00063 $this->addColumn('sku', array(
00064 'header' => Mage::helper('tag')->__('SKU'),
00065 'align' => 'center',
00066 'index' => 'sku'
00067 ));
00068 $this->addColumn('name', array(
00069 'header' => Mage::helper('tag')->__('Name'),
00070 'index' => 'name'
00071 ));
00072 $this->addColumn('tags', array(
00073 'header' => Mage::helper('tag')->__('Tags'),
00074 'index' => 'tags',
00075 'sortable' => false,
00076 'filter' => false,
00077 'renderer' => 'adminhtml/tag_grid_column_renderer_tags'
00078 ));
00079 $this->addColumn('action', array(
00080 'header' => Mage::helper('tag')->__('Action'),
00081 'align' => 'center',
00082 'width' => '120px',
00083 'format' => '<a href="'.$this->getUrl('*/*/customers/product_id/$product_id').'">'.Mage::helper('tag')->__('View Customers').'</a>',
00084 'filter' => false,
00085 'sortable' => false,
00086 'is_system' => true
00087 ));
00088
00089 return parent::_prepareColumns();
00090 }
00091
00092 }
00093