Mage_Adminhtml_Block_Dashboard_Tab_Products_Viewed Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Tab_Products_Viewed:

Mage_Adminhtml_Block_Dashboard_Grid 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 ()
 getRowUrl ($row)

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()


Detailed Description

Definition at line 35 of file Viewed.php.


Constructor & Destructor Documentation

__construct (  ) 

Setting default for every grid on dashboard

Reimplemented from Mage_Adminhtml_Block_Dashboard_Grid.

Definition at line 38 of file Viewed.php.

00039     {
00040         parent::__construct();
00041         $this->setId('productsReviewedGrid');
00042     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 44 of file Viewed.php.

00045     {
00046         if ($this->getParam('website')) {
00047             $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
00048             $storeId = array_pop($storeIds);
00049         } else if ($this->getParam('group')) {
00050             $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
00051             $storeId = array_pop($storeIds);
00052         } else {
00053             $storeId = (int)$this->getParam('store');
00054         }
00055         $collection = Mage::getResourceModel('reports/product_collection')
00056             ->addAttributeToSelect('*')
00057             ->addViewsCount()
00058             ->setStoreId($storeId)
00059             ->addStoreFilter($storeId);
00060 
00061         $this->setCollection($collection);
00062 
00063         return parent::_prepareCollection();
00064     }

_prepareColumns (  )  [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 66 of file Viewed.php.

00067     {
00068         $this->addColumn('name', array(
00069             'header'    =>Mage::helper('reports')->__('Product Name'),
00070             'sortable'  => false,
00071             'index'     =>'name'
00072         ));
00073 
00074         $this->addColumn('price', array(
00075             'header'    =>Mage::helper('reports')->__('Price'),
00076             'width'     =>'120px',
00077             'type'      =>'currency',
00078             'currency_code' => (string) Mage::app()->getStore((int)$this->getParam('store'))->getBaseCurrencyCode(),
00079             'sortable'  => false,
00080             'index'     =>'price'
00081         ));
00082 
00083         $this->addColumn('views', array(
00084             'header'    =>Mage::helper('reports')->__('Number of Views'),
00085             'width'     =>'120px',
00086             'align'     =>'right',
00087             'sortable'  => false,
00088             'index'     =>'views'
00089         ));
00090 
00091         $this->setFilterVisibility(false);
00092         $this->setPagerVisibility(false);
00093 
00094         return parent::_prepareColumns();
00095     }

getRowUrl ( row  ) 

Definition at line 97 of file Viewed.php.

00098     {
00099         $params = array('id'=>$row->getId());
00100         if ($this->getRequest()->getParam('store')) {
00101             $params['store'] = $this->getRequest()->getParam('store');
00102         }
00103         return $this->getUrl('*/catalog_product/edit', $params);
00104     }


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

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