Advertisement
andhiirawan

Magento Custom Dashboard Tab - Grids.php

Feb 24th, 2015 (edited)
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.48 KB | None | 0 0
  1. <?php
  2.  
  3. //Path : app\code\local\KS\Dashboard\Block\Adminhtml\Dashboard\Grids.php
  4.  
  5. class KS_Dashboard_Block_Adminhtml_Dashboard_Grids extends Mage_Adminhtml_Block_Widget_Tabs
  6. {
  7.     public function __construct()
  8.     {
  9.         parent::__construct();
  10.         $this->setId('grid_tab');
  11.         $this->setDestElementId('grid_tab_content');
  12.         $this->setTemplate('widget/tabshoriz.phtml');
  13.     }
  14.  
  15.     /**
  16.      * Prepare layout for dashboard bottom tabs
  17.      *
  18.      * To load block statically:
  19.      *     1) content must be generated
  20.      *     2) url should not be specified
  21.      *     3) class should not be 'ajax'
  22.      * To load with ajax:
  23.      *     1) do not load content
  24.      *     2) specify url (BE CAREFUL)
  25.      *     3) specify class 'ajax'
  26.      *
  27.      * @return Mage_Adminhtml_Block_Dashboard_Grids
  28.      */
  29.     protected function _prepareLayout()
  30.     {
  31.         // load this active tab statically
  32.         $this->addTab('ordered_products', array(
  33.             'label'     => $this->__('Bestsellers'),
  34.             'content'   => $this->getLayout()->createBlock('adminhtml/dashboard_tab_products_ordered')->toHtml(),
  35.             'active'    => true
  36.         ));
  37.  
  38.         // load other tabs with ajax
  39.         $this->addTab('reviewed_products', array(
  40.             'label'     => $this->__('Most Viewed Products'),
  41.             'url'       => $this->getUrl('*/*/productsViewed', array('_current'=>true)),
  42.             'class'     => 'ajax'
  43.         ));
  44.  
  45.         $this->addTab('new_customers', array(
  46.             'label'     => $this->__('New Customers'),
  47.             'url'       => $this->getUrl('*/*/customersNewest', array('_current'=>true)),
  48.             'class'     => 'ajax'
  49.         ));
  50.  
  51.         $this->addTab('customers', array(
  52.             'label'     => $this->__('Customers'),
  53.             'url'       => $this->getUrl('*/*/customersMost', array('_current'=>true)),
  54.             'class'     => 'ajax'
  55.         ));
  56.  
  57.         //New Members Tab
  58.         $this->addTab('new_members', array(
  59.             'label'     => $this->__('New Members'),
  60.             'url'       => $this->getUrl('*/*/membersNew', array('_current'=>true)),
  61.             'class'     => 'ajax'
  62.         ));
  63.  
  64.         //All Members Tab
  65.         $this->addTab('members', array(
  66.             'label'     => $this->__('All Members'),
  67.             'url'       => $this->getUrl('*/*/membersAll', array('_current'=>true)),
  68.             'class'     => 'ajax'
  69.         ));
  70.  
  71.         return parent::_prepareLayout();
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement