Advertisement
andhiirawan

Magento Custom Dashboard Tab - All.php

Feb 24th, 2015 (edited)
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <?php
  2.  
  3. //Path : app\code\local\KS\Dashboard\Block\Adminhtml\Dashboard\Tab\Members\All.php
  4.  
  5. class KS_Dashboard_Block_Adminhtml_Dashboard_Tab_Members_All extends Mage_Adminhtml_Block_Dashboard_Grid
  6. {
  7.  
  8.     public function __construct()
  9.     {
  10.         parent::__construct();
  11.         $this->setId('membersAllGrid');
  12.     }
  13.  
  14.     protected function _prepareCollection()
  15.     {
  16.         $collection = Mage::getResourceModel('reports/customer_collection')
  17.             ->addCustomerName();
  18.  
  19.         /* $storeFilter = 0;
  20.         if ($this->getParam('store')) {
  21.             $collection->addAttributeToFilter('store_id', $this->getParam('store'));
  22.             $storeFilter = 1;
  23.         } else if ($this->getParam('website')){
  24.             $storeIds = Mage::app()->getWebsite($this->getParam('website'))->getStoreIds();
  25.             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
  26.         } else if ($this->getParam('group')){
  27.             $storeIds = Mage::app()->getGroup($this->getParam('group'))->getStoreIds();
  28.             $collection->addAttributeToFilter('store_id', array('in' => $storeIds));
  29.         }
  30.  
  31.         $collection->addSumAvgTotals($storeFilter)
  32.             ->orderByTotalAmount(); */
  33.  
  34.         $this->setCollection($collection);
  35.         return parent::_prepareCollection();
  36.     }
  37.  
  38.     protected function _prepareColumns()
  39.     {
  40.         $this->addColumn('name', array(
  41.             'header'    => $this->__('Customer Name'),
  42.             'sortable'  => false,
  43.             'index'     => 'name'
  44.         ));
  45.  
  46.         $this->addColumn('orders_count', array(
  47.             'header'    => $this->__('Number of Orders'),
  48.             'sortable'  => false,
  49.             'index'     => 'orders_count',
  50.             'type'      => 'number'
  51.         ));
  52.  
  53.         $this->setFilterVisibility(false);
  54.         $this->setPagerVisibility(false);
  55.  
  56.         return parent::_prepareColumns();
  57.     }
  58.  
  59.     public function getRowUrl($row)
  60.     {
  61.         //return $this->getUrl('*/customer/edit', array('id'=>$row->getCustomerId()));
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement