How to set default filter in product grid by product type in admin?

Posted: December 27, 2012 in Magento, Version 1.3.*, Version 1.4.*, Version 1.6.*
Tags: , , ,

Hello All,

Today i found how to set default filter in product grid by product type (e.g.  ‘simple’) in admin product grid. For that you need to rewrite grid.php class of product in path  yourproject/app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php

You need to add below code in _construct() method of grid.php


  $this->setDefaultFilter( array(
                'type' => constant(get_class(Mage::getSingleton('catalog/product_type')) . '::TYPE_SIMPLE'),
            )); 

In above code ‘type’ is field and “constant(get_class(Mage::getSingleton(‘catalog/product_type’)) . ‘::TYPE_SIMPLE’)” is value, you can change its value as per your requirement.

I hope this code will help you, Thanks for reading my blog.

Thanks,

Bijal Bhavsar 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s