SHARE
TWEET

Untitled

a guest Jul 18th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <global>
  2. .....
  3.     <blocks>
  4.         <adminhtml>
  5.             <rewrite>
  6.             <catalog_product_grid>YourNameSpace_YourModuleName_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
  7.             </rewrite>
  8.         </adminhtml>
  9. ....
  10.     </blocks>
  11.   </global>
  12.      
  13. <?php
  14. class YourNameSpace_YourModuleName_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
  15. {
  16.  public function __construct()
  17.     {
  18.         parent::__construct();
  19.         $this->setDefaultSort('created_at');
  20.     }
  21. }
  22.      
  23. class YourNameSpace_YourModuleName_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
  24. {
  25.  
  26.     protected function _prepareCollection(){
  27.         $collection= parent::getCollection();
  28.         $this->setCollection($collection);
  29.         parent::_prepareCollection();
  30.          $this->getCollection()->addAttributeToSelect('created_at');
  31.        return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
  32.  
  33.         }
  34.            protected function _prepareColumns()
  35.     {
  36.         parent::_prepareColumns();
  37.         $this->addColumn('created_at',
  38.             array(
  39.                 'header'=> Mage::helper('catalog')->__('Created At'),
  40.                 'width' => '50px',
  41.                 'type'  => 'date',
  42.                 'index' => 'created_at',
  43.         ));
  44.         return parent::_prepareColumns();
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top