Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

[SOLVED]Admin Product Grid filter problem
Sr. Member
Total Posts:  153
Joined:  2008-05-27
Leicestershire, UK

I’ve done an override of the default ‘Manage Products’ grid within admin, so that it includes some custom attributes. However, I have a problem in that the number of products returned is being filtered/reduced by the (non) presence of one particular attribute.

Perhaps I need to explain this a little better! I have a custom, non mandatory drop down (single select) attribute called Signed. As its non mandatory, admin can leave it as blank when creating a product - so the available options are blank/null, signed, in plate, etc. Now, when I include this attribute in my product grid, only those products that have a value (signed or in plate) for Signed are returned - its is excluding or filtering out those with a blank/null value for Signed.

I suspect it might have something to do with the way I select the attribute but I’m not sure. Here’s the code where I get the attributes in Block_Catalog_Product_Grid:

class Fws_Adminhtml_Block_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid {
protected function _prepareCollection()
$collection Mage::getModel('catalog/product')->getCollection()

I then render the attributes like so:

protected function _prepareColumns()  {
/** Signed */
$signed_items Mage::getModel('eav/entity_attribute_option')
        foreach (
$signed_items as $signed_item) :
            if (
$signed_item->getAttributeCode() == 'signed')

'header'=> Mage::helper('catalog')->__('Signed'),
'width' => '80px',
'index' => 'signed',
'type'  => 'options',
'options' => $signed_options,


So, this is pretty much how I get other custom attributes that are drop downs - the only difference is that these other ones don’t have a ‘blank’ option. If I include the signed attribute in the grid, I get fewer products returned (50%!) than without it.

Now, I know I could add ‘unsigned’ as an option to my signed drop down but I don’t want to show that a product is unsigned - only that it is signed. At the moment, Mage will not display a null attribute - if possible I want to avoid having to do a check on the front end to see if a product is signed before displaying that attribute.

I suspect, like I said above, that the issue may be in the joinAttribute syntax - am I missing something here, something that will tell Zend to include nulls?

Any help gratefully received!


I resolved this issue - as suspected it was the join that was causing the issue - the join isn’t in fact necessary in this instance, as this attribute is one of the product’s custom attribute.

So instead of the join just use: ->addAttributeToSelect(’signed’)
Then render the column like so:

** Signed  */
$attribute Mage::getModel('eav/config')->getAttribute('catalog_product''signed');
$options = array();
$attribute->getSource()->getAllOptions(truetrue) as $option {
'value']] $option['label'];
'header'=> Mage::helper('catalog')->__('Signed?'),
'width' => '80px',
'index' => 'signed',
'type'  => 'options',
'options' => $options,


Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top