Anurag Patbandha Anurag Patbandha - 3 years ago 178
PHP Question

How to display yes/no attribute in custom product grid in Magento?

I am creating a new custom product grid which will show a custom yes/no attribute.

I have successfully displayed the value of yes no which is saved in database in 0,1 format.

need to show yes/no value

But I need yes or no to be shown in data field.

I have used below code in my Grid.php

enter image description here

Please help guys.

Answer Source

Solved it.

here is code to show yes/no input type attribute in product grid.

$this->addColumn('yesno',
            array(
                    'header'=> Mage::helper('catalog')->__('yesno'),
                    'width' => '50px',
                    'align' => 'right',
                    'index' => 'yesno',
                    'type'=>'options',
                    'options' => array('1' => 'Yes', '0' => 'No')
            ));

Sorry for images instead of code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download