Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getGridUrl ()
 getGridParentHtml ()
 getRowUrl ($row)

Protected Member Functions

 _getCustomer ()
 _prepareCollection ()
 _prepareColumns ()
 _addColumnFilterToCollection ($column)

Protected Attributes

 $_parentTemplate


Detailed Description

Definition at line 35 of file Wishlist.php.


Constructor & Destructor Documentation

__construct (  ) 

Initialize Grid

Reimplemented from Varien_Object.

Definition at line 48 of file Wishlist.php.

00049     {
00050         parent::__construct();
00051         $this->setId('wishlistGrid');
00052         $this->setUseAjax(true);
00053         $this->_parentTemplate = $this->getTemplate();
00054         $this->setTemplate('customer/tab/wishlist.phtml');
00055         $this->setEmptyText(Mage::helper('customer')->__('No Items Found'));
00056     }


Member Function Documentation

_addColumnFilterToCollection ( column  )  [protected]

Add column filter to collection

Parameters:
Mage_Adminhtml_Block_Widget_Grid_Column $column
Returns:
Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 176 of file Wishlist.php.

00177     {
00178         if($column->getId()=='store') {
00179             $this->getCollection()->addFieldToFilter('store_id', $column->getFilter()->getCondition());
00180             return $this;
00181         }
00182 
00183         if ($this->getCollection() && $column->getFilter()->getValue()) {
00184             $this->getCollection()->addFieldToFilter($column->getIndex(), $column->getFilter()->getCondition());
00185         }
00186 
00187         return $this;
00188     }

_getCustomer (  )  [protected]

Retrieve current customer object

Returns:
Mage_Customer_Model_Customer

Definition at line 63 of file Wishlist.php.

00064     {
00065         return Mage::registry('current_customer');
00066     }

_prepareCollection (  )  [protected]

Prepare customer wishlist product collection

Returns:
Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 73 of file Wishlist.php.

00074     {
00075         $collection = Mage::getModel('wishlist/wishlist')
00076             ->loadByCustomer($this->_getCustomer())
00077             ->setSharedStoreIds($this->_getCustomer()->getSharedStoreIds())
00078             ->getProductCollection()
00079                 ->addAttributeToSelect('name')
00080                 ->addAttributeToSelect('price')
00081                 ->addAttributeToSelect('small_image')
00082                 ->addStoreData();
00083 
00084         $this->setCollection($collection);
00085 
00086         return parent::_prepareCollection();
00087     }

_prepareColumns (  )  [protected]

Prepare Grid columns

Returns:
Mage_Adminhtml_Block_Customer_Edit_Tab_Wishlist

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 94 of file Wishlist.php.

00095     {
00096 
00097         /*$this->addColumn('product_id', array(
00098             'header'    => Mage::helper('customer')->__('ID'),
00099             'index'     => 'product_id',
00100             'type'      => 'number',
00101             'width'     => '130px'
00102         ));*/
00103 
00104         $this->addColumn('product_name', array(
00105             'header'    => Mage::helper('customer')->__('Product name'),
00106             'index'     => 'name'
00107         ));
00108 
00109         $this->addColumn('description', array(
00110             'header'    => Mage::helper('customer')->__('User description'),
00111             'index'     => 'description',
00112             'renderer'  => 'adminhtml/customer_edit_tab_wishlist_grid_renderer_description'
00113         ));
00114 
00115         if (!Mage::app()->isSingleStoreMode()) {
00116             $this->addColumn('store', array(
00117                 'header'    => Mage::helper('customer')->__('Added From'),
00118                 'index'     => 'store_name',
00119                 'type'      => 'store'
00120             ));
00121         }
00122 
00123         $this->addColumn('visible_in', array(
00124             'header'    => Mage::helper('customer')->__('Visible In'),
00125             'index'     => 'store_id',
00126             'type'      => 'store'
00127         ));
00128 
00129         $this->addColumn('added_at', array(
00130             'header'    => Mage::helper('customer')->__('Date Added'),
00131             'index'     => 'added_at',
00132             'gmtoffset' => true,
00133             'type'      => 'date'
00134         ));
00135 
00136         $this->addColumn('days', array(
00137             'header'    => Mage::helper('customer')->__('Days in Wishlist'),
00138             'index'     => 'days_in_wishlist',
00139             'type'      => 'number'
00140         ));
00141 
00142         $this->addColumn('action', array(
00143             'header'    => Mage::helper('customer')->__('Action'),
00144             'index'     => 'wishlist_item_id',
00145             'type'      => 'action',
00146             'filter'    => false,
00147             'sortable'  => false,
00148             'actions'   => array(
00149                 array(
00150                     'caption' =>  Mage::helper('customer')->__('Delete'),
00151                     'url'     =>  '#',
00152                     'onclick' =>  'return wishlistControl.removeItem($wishlist_item_id);'
00153                 )
00154             )
00155         ));
00156 
00157         return parent::_prepareColumns();
00158     }

getGridParentHtml (  ) 

Retrieve Grid Parent Block HTML

Returns:
string

Definition at line 195 of file Wishlist.php.

00196     {
00197         $templateName = Mage::getDesign()->getTemplateFilename($this->_parentTemplate, array('_relative'=>true));
00198         return $this->fetchView($templateName);
00199     }

getGridUrl (  ) 

Retrieve Grid URL

Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 165 of file Wishlist.php.

00166     {
00167         return $this->getUrl('*/*/wishlist', array('_current'=>true));
00168     }

getRowUrl ( row  ) 

Retrieve Row click URL

Returns:
string

Definition at line 206 of file Wishlist.php.

00207     {
00208         return $this->getUrl('*/catalog_product/edit', array('id' => $row->getProductId()));
00209     }


Member Data Documentation

$_parentTemplate [protected]

Definition at line 42 of file Wishlist.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:48 2009 for Magento by  doxygen 1.5.8